|
@@ -1718,7 +1718,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
{
|
|
{
|
|
if (Config.ALT_RECOMMEND)
|
|
if (Config.ALT_RECOMMEND)
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
@@ -6051,8 +6051,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
public void updateOnlineStatus()
|
|
public void updateOnlineStatus()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
-
|
|
|
|
|
|
+ Connection con = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
@@ -6078,12 +6077,12 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private boolean createDb()
|
|
private boolean createDb()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
- PreparedStatement statement;
|
|
|
|
- statement = con.prepareStatement(INSERT_CHARACTER);
|
|
|
|
|
|
+ PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER);
|
|
|
|
+
|
|
statement.setString(1, _accountName);
|
|
statement.setString(1, _accountName);
|
|
statement.setInt(2, getObjectId());
|
|
statement.setInt(2, getObjectId());
|
|
statement.setString(3, getName());
|
|
statement.setString(3, getName());
|
|
@@ -6119,6 +6118,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
statement.setInt(33, isNoble() ? 1 :0);
|
|
statement.setInt(33, isNoble() ? 1 :0);
|
|
statement.setLong(34, 0);
|
|
statement.setLong(34, 0);
|
|
statement.setLong(35,System.currentTimeMillis());
|
|
statement.setLong(35,System.currentTimeMillis());
|
|
|
|
+
|
|
statement.executeUpdate();
|
|
statement.executeUpdate();
|
|
statement.close();
|
|
statement.close();
|
|
}
|
|
}
|
|
@@ -6151,7 +6151,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
private static L2PcInstance restore(int objectId)
|
|
private static L2PcInstance restore(int objectId)
|
|
{
|
|
{
|
|
L2PcInstance player = null;
|
|
L2PcInstance player = null;
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -6416,7 +6416,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private static boolean restoreSubClassData(L2PcInstance player)
|
|
private static boolean restoreSubClassData(L2PcInstance player)
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -6488,7 +6488,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
if (getCommonRecipeBook().length == 0 && getDwarvenRecipeBook().length == 0)
|
|
if (getCommonRecipeBook().length == 0 && getDwarvenRecipeBook().length == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try {
|
|
try {
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
@@ -6531,7 +6531,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private void restoreRecipeBook()
|
|
private void restoreRecipeBook()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try {
|
|
try {
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
@@ -6577,7 +6577,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
|
|
|
|
private void storeCharBase()
|
|
private void storeCharBase()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -6590,10 +6590,9 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
_classIndex = currentClassIndex;
|
|
_classIndex = currentClassIndex;
|
|
|
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
- PreparedStatement statement;
|
|
|
|
-
|
|
|
|
// Update base class
|
|
// Update base class
|
|
- statement = con.prepareStatement(UPDATE_CHARACTER);
|
|
|
|
|
|
+ PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER);
|
|
|
|
+
|
|
statement.setInt(1, level);
|
|
statement.setInt(1, level);
|
|
statement.setInt(2, getMaxHp());
|
|
statement.setInt(2, getMaxHp());
|
|
statement.setDouble(3, getCurrentHp());
|
|
statement.setDouble(3, getCurrentHp());
|
|
@@ -6660,18 +6659,17 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
|
|
|
|
private void storeCharSub()
|
|
private void storeCharSub()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
- PreparedStatement statement;
|
|
|
|
-
|
|
|
|
|
|
+ PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS);
|
|
|
|
+
|
|
if (getTotalSubClasses() > 0)
|
|
if (getTotalSubClasses() > 0)
|
|
{
|
|
{
|
|
for (SubClass subClass : getSubClasses().values())
|
|
for (SubClass subClass : getSubClasses().values())
|
|
{
|
|
{
|
|
- statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS);
|
|
|
|
statement.setLong(1, subClass.getExp());
|
|
statement.setLong(1, subClass.getExp());
|
|
statement.setInt(2, subClass.getSp());
|
|
statement.setInt(2, subClass.getSp());
|
|
statement.setInt(3, subClass.getLevel());
|
|
statement.setInt(3, subClass.getLevel());
|
|
@@ -6680,8 +6678,8 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
statement.setInt(6, subClass.getClassIndex());
|
|
statement.setInt(6, subClass.getClassIndex());
|
|
|
|
|
|
statement.execute();
|
|
statement.execute();
|
|
- statement.close();
|
|
|
|
}
|
|
}
|
|
|
|
+ statement.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e) {
|
|
catch (Exception e) {
|
|
@@ -6694,14 +6692,14 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
{
|
|
{
|
|
if (!Config.STORE_SKILL_COOLTIME) return;
|
|
if (!Config.STORE_SKILL_COOLTIME) return;
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
- PreparedStatement statement;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
// Delete all current stored effects for char to avoid dupe
|
|
// Delete all current stored effects for char to avoid dupe
|
|
- statement = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
|
|
|
|
+ PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
|
|
+
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(2, getClassIndex());
|
|
statement.setInt(2, getClassIndex());
|
|
statement.execute();
|
|
statement.execute();
|
|
@@ -6855,23 +6853,22 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
// Remove a skill from the L2Character and its Func objects from calculator set of the L2Character
|
|
// Remove a skill from the L2Character and its Func objects from calculator set of the L2Character
|
|
L2Skill oldSkill = super.removeSkill(skill);
|
|
L2Skill oldSkill = super.removeSkill(skill);
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
// Remove or update a L2PcInstance skill from the character_skills table of the database
|
|
// Remove or update a L2PcInstance skill from the character_skills table of the database
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
- PreparedStatement statement;
|
|
|
|
|
|
+ PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR);
|
|
|
|
|
|
if (oldSkill != null)
|
|
if (oldSkill != null)
|
|
{
|
|
{
|
|
- statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR);
|
|
|
|
statement.setInt(1, oldSkill.getId());
|
|
statement.setInt(1, oldSkill.getId());
|
|
statement.setInt(2, getObjectId());
|
|
statement.setInt(2, getObjectId());
|
|
statement.setInt(3, getClassIndex());
|
|
statement.setInt(3, getClassIndex());
|
|
statement.execute();
|
|
statement.execute();
|
|
- statement.close();
|
|
|
|
}
|
|
}
|
|
|
|
+ statement.close();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
@@ -6908,7 +6905,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
if (newClassIndex > -1)
|
|
if (newClassIndex > -1)
|
|
classIndex = newClassIndex;
|
|
classIndex = newClassIndex;
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -6956,13 +6953,14 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private void restoreSkills()
|
|
private void restoreSkills()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
// Retrieve all skills of this L2PcInstance from the database
|
|
// Retrieve all skills of this L2PcInstance from the database
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
|
|
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR);
|
|
|
|
+
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(2, getClassIndex());
|
|
statement.setInt(2, getClassIndex());
|
|
ResultSet rset = statement.executeQuery();
|
|
ResultSet rset = statement.executeQuery();
|
|
@@ -7002,7 +7000,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
public void restoreEffects()
|
|
public void restoreEffects()
|
|
{
|
|
{
|
|
L2Object[] targets = new L2Character[]{this};
|
|
L2Object[] targets = new L2Character[]{this};
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -7102,7 +7100,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private void restoreHenna()
|
|
private void restoreHenna()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -7159,7 +7157,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
*/
|
|
*/
|
|
private void restoreRecom()
|
|
private void restoreRecom()
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -7218,15 +7216,17 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
L2HennaInstance henna = _henna[slot];
|
|
L2HennaInstance henna = _henna[slot];
|
|
_henna[slot] = null;
|
|
_henna[slot] = null;
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA);
|
|
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA);
|
|
|
|
+
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(2, slot+1);
|
|
statement.setInt(2, slot+1);
|
|
statement.setInt(3, getClassIndex());
|
|
statement.setInt(3, getClassIndex());
|
|
|
|
+
|
|
statement.execute();
|
|
statement.execute();
|
|
statement.close();
|
|
statement.close();
|
|
}
|
|
}
|
|
@@ -7280,16 +7280,18 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
// Calculate Henna modifiers of this L2PcInstance
|
|
// Calculate Henna modifiers of this L2PcInstance
|
|
recalcHennaStats();
|
|
recalcHennaStats();
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA);
|
|
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA);
|
|
|
|
+
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(2, henna.getSymbolId());
|
|
statement.setInt(2, henna.getSymbolId());
|
|
statement.setInt(3, i+1);
|
|
statement.setInt(3, i+1);
|
|
statement.setInt(4, getClassIndex());
|
|
statement.setInt(4, getClassIndex());
|
|
|
|
+
|
|
statement.execute();
|
|
statement.execute();
|
|
statement.close();
|
|
statement.close();
|
|
}
|
|
}
|
|
@@ -9030,19 +9032,21 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
newClass.setClassId(classId);
|
|
newClass.setClassId(classId);
|
|
newClass.setClassIndex(classIndex);
|
|
newClass.setClassIndex(classIndex);
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
// Store the basic info about this new sub-class.
|
|
// Store the basic info about this new sub-class.
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS);
|
|
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS);
|
|
|
|
+
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(2, newClass.getClassId());
|
|
statement.setInt(2, newClass.getClassId());
|
|
statement.setLong(3, newClass.getExp());
|
|
statement.setLong(3, newClass.getExp());
|
|
statement.setInt(4, newClass.getSp());
|
|
statement.setInt(4, newClass.getSp());
|
|
statement.setInt(5, newClass.getLevel());
|
|
statement.setInt(5, newClass.getLevel());
|
|
statement.setInt(6, newClass.getClassIndex()); // <-- Added
|
|
statement.setInt(6, newClass.getClassIndex()); // <-- Added
|
|
|
|
+
|
|
statement.execute();
|
|
statement.execute();
|
|
statement.close();
|
|
statement.close();
|
|
}
|
|
}
|
|
@@ -9105,7 +9109,7 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
if (Config.DEBUG)
|
|
if (Config.DEBUG)
|
|
_log.info(getName() + " has requested to modify sub class index " + classIndex + " from class ID " + oldClassId + " to " + newClassId + ".");
|
|
_log.info(getName() + " has requested to modify sub class index " + classIndex + " from class ID " + oldClassId + " to " + newClassId + ".");
|
|
|
|
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -9508,12 +9512,13 @@ public final class L2PcInstance extends L2PlayableInstance
|
|
{
|
|
{
|
|
if (Config.ALT_RECOMMEND)
|
|
if (Config.ALT_RECOMMEND)
|
|
{
|
|
{
|
|
- java.sql.Connection con = null;
|
|
|
|
|
|
+ Connection con = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS);
|
|
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS);
|
|
statement.setInt(1, getObjectId());
|
|
statement.setInt(1, getObjectId());
|
|
|
|
+
|
|
statement.execute();
|
|
statement.execute();
|
|
statement.close();
|
|
statement.close();
|
|
|
|
|