* @param noban boolean
* @param bity boolean
*/
public synchronized void setClassId(final int id, boolean noban, boolean bity)
{
ClassId classId = ClassId.VALUES[id];
if (!noban && !classId.equalsOrChildOf(ClassId.VALUES[getActiveClassId()]) && !getVarB("awakenByStoneOfDestiny",false) && !(getPlayerAccess().CanChangeClass || Config.EVERYBODY_HAS_ADMIN_RIGHTS))
{
Thread.dumpStack();
return;
}
ClassId oldClassId = getClassId();
if (!_subClassList.containsClassId(id))
{
final SubClass cclass = getActiveSubClass();
final int oldClass = cclass.getClassId();
_subClassList.changeSubClassId(oldClass, id);
changeClassInDb(oldClass, id, cclass.getDefaultClassId() == 0 ? getSubClassList().getBaseSubClass().getDefaultClassId() : cclass.getDefaultClassId());
if (cclass.isBase())
{
addClanPointsOnProfession(id);
}
switch (classId)
{
case CARDINAL:
ItemFunctions.addItem(this, 15307, 7, true);
break;
case EVAS_SAINT:
ItemFunctions.addItem(this, 15308, 7, true);
break;
case SHILLIEN_SAINT:
ItemFunctions.addItem(this, 15309, 7, true);
break;
default:
break;
}
rewardSkills(true,false);
storeCharSubClasses();
broadcastCharInfo();
}
if ((oldClassId == null) || !oldClassId.isOfRace(getClassId().getRace()) || !oldClassId.isOfType(getClassId().getType()))
{
PlayerTemplate t = PlayerTemplateHolder.getInstance().getPlayerTemplate(getRace(), classId, Sex.VALUES[getSex()]);
if (t == null)
{
_log.error("Missing template for classId: " + id);