Small improvement for storeEffect method.
Contributed by Sahar.
This commit is contained in:
+87
-83
@@ -7258,115 +7258,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7265,115 +7265,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7267,115 +7267,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7261,115 +7261,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7243,115 +7243,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7243,115 +7243,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7244,115 +7244,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7149,115 +7149,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-71
@@ -7453,100 +7453,104 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE);)
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Integer> storedSkills = new ArrayList<>();
|
final List<Integer> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isToggle())
|
if (skill.isToggle())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(5, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(7, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(8, _classIndex);
|
|
||||||
statement.setInt(9, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Integer, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Integer, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final int hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, -1);
|
statement.setInt(4, info.getTime());
|
||||||
statement.setLong(5, t.getReuse());
|
|
||||||
statement.setLong(6, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(7, 1); // Restore type 1, skill reuse.
|
statement.setLong(5, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(7, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(8, _classIndex);
|
statement.setInt(8, _classIndex);
|
||||||
statement.setInt(9, ++buff_index);
|
statement.setInt(9, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Integer, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Integer, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final int hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, -1);
|
||||||
|
statement.setLong(5, t.getReuse());
|
||||||
|
statement.setLong(6, t.getStamp());
|
||||||
|
statement.setInt(7, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(8, _classIndex);
|
||||||
|
statement.setInt(9, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7229,115 +7229,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7230,115 +7230,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7215,115 +7215,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7242,115 +7242,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7242,115 +7242,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-83
@@ -7133,115 +7133,119 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
|
||||||
{
|
{
|
||||||
// Delete all current stored effects for char to avoid dupe
|
// Delete all current stored effects for char to avoid dupe
|
||||||
delete.setInt(1, getObjectId());
|
try (PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||||
delete.setInt(2, _classIndex);
|
{
|
||||||
delete.execute();
|
delete.setInt(1, getObjectId());
|
||||||
|
delete.setInt(2, _classIndex);
|
||||||
|
delete.execute();
|
||||||
|
}
|
||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
final List<Long> storedSkills = new ArrayList<>();
|
final List<Long> storedSkills = new ArrayList<>();
|
||||||
|
|
||||||
// Store all effect data along with calulated remaining
|
// Store all effect data along with calulated remaining
|
||||||
// reuse delays for matching skills. 'restore_type'= 0.
|
// reuse delays for matching skills. 'restore_type'= 0.
|
||||||
if (storeEffects)
|
try (PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
|
||||||
{
|
{
|
||||||
for (BuffInfo info : getEffectList().getEffects())
|
if (storeEffects)
|
||||||
{
|
{
|
||||||
if (info == null)
|
for (BuffInfo info : getEffectList().getEffects())
|
||||||
{
|
{
|
||||||
continue;
|
if (info == null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final Skill skill = info.getSkill();
|
final Skill skill = info.getSkill();
|
||||||
|
|
||||||
// Do not store those effects.
|
// Do not store those effects.
|
||||||
if (skill.isDeleteAbnormalOnLeave())
|
if (skill.isDeleteAbnormalOnLeave())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not save heals.
|
// Do not save heals.
|
||||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggles are skipped, unless they are necessary to be always on.
|
// Toggles are skipped, unless they are necessary to be always on.
|
||||||
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
if ((skill.isToggle() && !skill.isNecessaryToggle()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isMentoring())
|
if (skill.isMentoring())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dances and songs are not kept in retail.
|
// Dances and songs are not kept in retail.
|
||||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedSkills.add(skill.getReuseHashCode());
|
storedSkills.add(skill.getReuseHashCode());
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
|
||||||
statement.setInt(2, skill.getId());
|
|
||||||
statement.setInt(3, skill.getLevel());
|
|
||||||
statement.setInt(4, skill.getSubLevel());
|
|
||||||
statement.setInt(5, info.getTime());
|
|
||||||
|
|
||||||
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
|
||||||
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
|
||||||
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
|
||||||
|
|
||||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
|
||||||
statement.setInt(9, _classIndex);
|
|
||||||
statement.setInt(10, ++buff_index);
|
|
||||||
statement.addBatch();
|
|
||||||
}
|
|
||||||
statement.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skills under reuse.
|
|
||||||
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
|
||||||
if (reuseTimeStamps != null)
|
|
||||||
{
|
|
||||||
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
|
||||||
{
|
|
||||||
final long hash = ts.getKey();
|
|
||||||
if (storedSkills.contains(hash))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final TimeStamp t = ts.getValue();
|
|
||||||
if ((t != null) && t.hasNotPassed())
|
|
||||||
{
|
|
||||||
storedSkills.add(hash);
|
|
||||||
|
|
||||||
statement.setInt(1, getObjectId());
|
statement.setInt(1, getObjectId());
|
||||||
statement.setInt(2, t.getSkillId());
|
statement.setInt(2, skill.getId());
|
||||||
statement.setInt(3, t.getSkillLvl());
|
statement.setInt(3, skill.getLevel());
|
||||||
statement.setInt(4, t.getSkillSubLvl());
|
statement.setInt(4, skill.getSubLevel());
|
||||||
statement.setInt(5, -1);
|
statement.setInt(5, info.getTime());
|
||||||
statement.setLong(6, t.getReuse());
|
|
||||||
statement.setDouble(7, t.getStamp());
|
final TimeStamp t = getSkillReuseTimeStamp(skill.getReuseHashCode());
|
||||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
statement.setLong(6, (t != null) && t.hasNotPassed() ? t.getReuse() : 0);
|
||||||
|
statement.setDouble(7, (t != null) && t.hasNotPassed() ? t.getStamp() : 0);
|
||||||
|
|
||||||
|
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||||
statement.setInt(9, _classIndex);
|
statement.setInt(9, _classIndex);
|
||||||
statement.setInt(10, ++buff_index);
|
statement.setInt(10, ++buff_index);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skills under reuse.
|
||||||
|
final Map<Long, TimeStamp> reuseTimeStamps = getSkillReuseTimeStamps();
|
||||||
|
if (reuseTimeStamps != null)
|
||||||
|
{
|
||||||
|
for (Entry<Long, TimeStamp> ts : reuseTimeStamps.entrySet())
|
||||||
|
{
|
||||||
|
final long hash = ts.getKey();
|
||||||
|
if (storedSkills.contains(hash))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TimeStamp t = ts.getValue();
|
||||||
|
if ((t != null) && t.hasNotPassed())
|
||||||
|
{
|
||||||
|
storedSkills.add(hash);
|
||||||
|
|
||||||
|
statement.setInt(1, getObjectId());
|
||||||
|
statement.setInt(2, t.getSkillId());
|
||||||
|
statement.setInt(3, t.getSkillLvl());
|
||||||
|
statement.setInt(4, t.getSkillSubLvl());
|
||||||
|
statement.setInt(5, -1);
|
||||||
|
statement.setLong(6, t.getReuse());
|
||||||
|
statement.setDouble(7, t.getStamp());
|
||||||
|
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||||
|
statement.setInt(9, _classIndex);
|
||||||
|
statement.setInt(10, ++buff_index);
|
||||||
|
statement.addBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user