Removed subclassLock from modifySubClass method.
This commit is contained in:
@@ -9593,90 +9593,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9596,90 +9596,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9598,90 +9598,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9589,90 +9589,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9613,90 +9613,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9613,90 +9613,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9619,90 +9619,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9634,90 +9634,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9736,90 +9736,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9762,90 +9762,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -9812,90 +9812,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
@@ -10161,69 +10161,56 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId)
|
public boolean modifySubClass(int classIndex, int newClassId)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
|
// Remove all henna info stored for this sub-class.
|
||||||
|
deleteHennas.setInt(1, getObjectId());
|
||||||
|
deleteHennas.setInt(2, classIndex);
|
||||||
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
|
||||||
|
// This must be done in order to maintain data consistency.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
{
|
{
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
|
|
||||||
// This must be done in order to maintain data consistency.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify to scripts before class is removed.
|
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
|
||||||
{
|
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_subclassLock = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex);
|
return addSubClass(newClassId, classIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10044,69 +10044,56 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId)
|
public boolean modifySubClass(int classIndex, int newClassId)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
|
// Remove all henna info stored for this sub-class.
|
||||||
|
deleteHennas.setInt(1, getObjectId());
|
||||||
|
deleteHennas.setInt(2, classIndex);
|
||||||
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
|
||||||
|
// This must be done in order to maintain data consistency.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
{
|
{
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
|
|
||||||
// This must be done in order to maintain data consistency.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify to scripts before class is removed.
|
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
|
||||||
{
|
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_subclassLock = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex);
|
return addSubClass(newClassId, classIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+57
-73
@@ -9495,90 +9495,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9495,90 +9495,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9481,90 +9481,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9508,90 +9508,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9508,90 +9508,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9462,90 +9462,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9483,90 +9483,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9627,90 +9627,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9693,90 +9693,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
+57
-73
@@ -9693,90 +9693,74 @@ public class Player extends Playable
|
|||||||
*/
|
*/
|
||||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||||
{
|
{
|
||||||
if (_subclassLock)
|
// Notify to scripts before class is removed.
|
||||||
|
if (!getSubClasses().isEmpty()) // also null check
|
||||||
|
{
|
||||||
|
final int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
||||||
|
if (subClass == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_subclassLock = true;
|
|
||||||
|
|
||||||
try
|
if (subClass.isDualClass())
|
||||||
{
|
{
|
||||||
// Notify to scripts before class is removed.
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
||||||
if (!getSubClasses().isEmpty()) // also null check
|
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
||||||
|
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||||
|
if (revelationSkill != 0)
|
||||||
{
|
{
|
||||||
final int classId = getSubClasses().get(classIndex).getClassId();
|
removeSkill(revelationSkill);
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
|
||||||
}
|
}
|
||||||
|
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||||
final SubClassHolder subClass = getSubClasses().get(classIndex);
|
if (revelationSkill != 0)
|
||||||
if (subClass == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
removeSkill(revelationSkill);
|
||||||
}
|
|
||||||
|
|
||||||
if (subClass.isDualClass())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_DUAL_CLASS);
|
|
||||||
getVariables().remove(PlayerVariables.ABILITY_POINTS_USED_DUAL_CLASS);
|
|
||||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
|
||||||
if (revelationSkill != 0)
|
|
||||||
{
|
|
||||||
removeSkill(revelationSkill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove after stats are recalculated.
|
|
||||||
getSubClasses().remove(classIndex);
|
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
|
||||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
|
||||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
|
||||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
|
||||||
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
|
||||||
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
|
||||||
{
|
|
||||||
// Remove all henna info stored for this sub-class.
|
|
||||||
deleteHennas.setInt(1, getObjectId());
|
|
||||||
deleteHennas.setInt(2, classIndex);
|
|
||||||
deleteHennas.execute();
|
|
||||||
|
|
||||||
// Remove all shortcuts info stored for this sub-class.
|
|
||||||
deleteShortcuts.setInt(1, getObjectId());
|
|
||||||
deleteShortcuts.setInt(2, classIndex);
|
|
||||||
deleteShortcuts.execute();
|
|
||||||
|
|
||||||
// Remove all effects info stored for this sub-class.
|
|
||||||
deleteSkillReuse.setInt(1, getObjectId());
|
|
||||||
deleteSkillReuse.setInt(2, classIndex);
|
|
||||||
deleteSkillReuse.execute();
|
|
||||||
|
|
||||||
// Remove all skill info stored for this sub-class.
|
|
||||||
deleteSkills.setInt(1, getObjectId());
|
|
||||||
deleteSkills.setInt(2, classIndex);
|
|
||||||
deleteSkills.execute();
|
|
||||||
|
|
||||||
// Remove all basic info stored about this sub-class.
|
|
||||||
deleteSubclass.setInt(1, getObjectId());
|
|
||||||
deleteSubclass.setInt(2, classIndex);
|
|
||||||
deleteSubclass.execute();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
|
// Remove after stats are recalculated.
|
||||||
|
getSubClasses().remove(classIndex);
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||||
|
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||||
|
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||||
|
PreparedStatement deleteSkills = con.prepareStatement(DELETE_CHAR_SKILLS);
|
||||||
|
PreparedStatement deleteSubclass = con.prepareStatement(DELETE_CHAR_SUBCLASS))
|
||||||
{
|
{
|
||||||
_subclassLock = false;
|
// Remove all henna info stored for this sub-class.
|
||||||
getStat().recalculateStats(false);
|
deleteHennas.setInt(1, getObjectId());
|
||||||
updateAbnormalVisualEffects();
|
deleteHennas.setInt(2, classIndex);
|
||||||
sendSkillList();
|
deleteHennas.execute();
|
||||||
|
|
||||||
|
// Remove all shortcuts info stored for this sub-class.
|
||||||
|
deleteShortcuts.setInt(1, getObjectId());
|
||||||
|
deleteShortcuts.setInt(2, classIndex);
|
||||||
|
deleteShortcuts.execute();
|
||||||
|
|
||||||
|
// Remove all effects info stored for this sub-class.
|
||||||
|
deleteSkillReuse.setInt(1, getObjectId());
|
||||||
|
deleteSkillReuse.setInt(2, classIndex);
|
||||||
|
deleteSkillReuse.execute();
|
||||||
|
|
||||||
|
// Remove all skill info stored for this sub-class.
|
||||||
|
deleteSkills.setInt(1, getObjectId());
|
||||||
|
deleteSkills.setInt(2, classIndex);
|
||||||
|
deleteSkills.execute();
|
||||||
|
|
||||||
|
// Remove all basic info stored about this sub-class.
|
||||||
|
deleteSubclass.setInt(1, getObjectId());
|
||||||
|
deleteSubclass.setInt(2, classIndex);
|
||||||
|
deleteSubclass.execute();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSubClass(newClassId, classIndex, isDualClass);
|
return addSubClass(newClassId, classIndex, isDualClass);
|
||||||
|
|||||||
Reference in New Issue
Block a user