
- Renamed AuctionManager into ClanHallAuctionManager. - Created Comission (Auction house) system. - Reworked vitality system from account based to subclass based.
163 lines
3.5 KiB
Java
163 lines
3.5 KiB
Java
/*
|
|
* Copyright (C) 2004-2015 L2J Server
|
|
*
|
|
* This file is part of L2J Server.
|
|
*
|
|
* L2J Server is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* L2J Server is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package com.l2jserver.gameserver.model.base;
|
|
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.gameserver.data.xml.impl.ExperienceData;
|
|
|
|
/**
|
|
* Character Sub-Class Definition <BR>
|
|
* Used to store key information about a character's sub-class.
|
|
* @author Tempy
|
|
*/
|
|
public final class SubClass
|
|
{
|
|
private static final byte _maxLevel = Config.MAX_SUBCLASS_LEVEL < ExperienceData.getInstance().getMaxLevel() ? Config.MAX_SUBCLASS_LEVEL : (byte) (ExperienceData.getInstance().getMaxLevel() - 1);
|
|
|
|
private PlayerClass _class;
|
|
private long _exp = ExperienceData.getInstance().getExpForLevel(Config.BASE_SUBCLASS_LEVEL);
|
|
private long _sp = 0;
|
|
private byte _level = Config.BASE_SUBCLASS_LEVEL;
|
|
private int _classIndex = 1;
|
|
|
|
private int _vitalityPoints = 140000;
|
|
private boolean _dualClass = false;
|
|
|
|
public SubClass()
|
|
{
|
|
// Used for specifying ALL attributes of a sub class directly,
|
|
// using the preset default values.
|
|
}
|
|
|
|
public PlayerClass getClassDefinition()
|
|
{
|
|
return _class;
|
|
}
|
|
|
|
public int getClassId()
|
|
{
|
|
return _class.ordinal();
|
|
}
|
|
|
|
public long getExp()
|
|
{
|
|
return _exp;
|
|
}
|
|
|
|
public long getSp()
|
|
{
|
|
return _sp;
|
|
}
|
|
|
|
public byte getLevel()
|
|
{
|
|
return _level;
|
|
}
|
|
|
|
public int getVitalityPoints()
|
|
{
|
|
return _vitalityPoints;
|
|
}
|
|
|
|
/**
|
|
* First Sub-Class is index 1.
|
|
* @return int _classIndex
|
|
*/
|
|
public int getClassIndex()
|
|
{
|
|
return _classIndex;
|
|
}
|
|
|
|
public void setClassId(int classId)
|
|
{
|
|
_class = PlayerClass.values()[classId];
|
|
}
|
|
|
|
public void setExp(long expValue)
|
|
{
|
|
if (!_dualClass && (expValue > (ExperienceData.getInstance().getExpForLevel(_maxLevel + 1) - 1)))
|
|
{
|
|
expValue = ExperienceData.getInstance().getExpForLevel(_maxLevel + 1) - 1;
|
|
}
|
|
|
|
_exp = expValue;
|
|
}
|
|
|
|
public void setSp(long spValue)
|
|
{
|
|
_sp = spValue;
|
|
}
|
|
|
|
public void setClassIndex(int classIndex)
|
|
{
|
|
_classIndex = classIndex;
|
|
}
|
|
|
|
public boolean isDualClass()
|
|
{
|
|
return _dualClass;
|
|
}
|
|
|
|
public void setIsDualClass(boolean dualClass)
|
|
{
|
|
_dualClass = dualClass;
|
|
}
|
|
|
|
public void setLevel(byte levelValue)
|
|
{
|
|
if (!_dualClass && (levelValue > _maxLevel))
|
|
{
|
|
levelValue = _maxLevel;
|
|
}
|
|
else if (levelValue < Config.BASE_SUBCLASS_LEVEL)
|
|
{
|
|
levelValue = Config.BASE_SUBCLASS_LEVEL;
|
|
}
|
|
|
|
_level = levelValue;
|
|
}
|
|
|
|
public void setVitalityPoints(int vit)
|
|
{
|
|
_vitalityPoints = vit;
|
|
}
|
|
|
|
public void incLevel()
|
|
{
|
|
if (!_dualClass && (getLevel() == _maxLevel))
|
|
{
|
|
return;
|
|
}
|
|
|
|
_level++;
|
|
setExp(ExperienceData.getInstance().getExpForLevel(getLevel()));
|
|
}
|
|
|
|
public void decLevel()
|
|
{
|
|
if (getLevel() == Config.BASE_SUBCLASS_LEVEL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_level--;
|
|
setExp(ExperienceData.getInstance().getExpForLevel(getLevel()));
|
|
}
|
|
}
|