Addition of Config to set maximum player level.
This commit is contained in:
@ -25,6 +25,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
|
||||
/**
|
||||
@ -67,12 +68,27 @@ public final class ExperienceData implements IGameXmlReader
|
||||
MAX_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxLevel").getNodeValue()) + 1);
|
||||
MAX_PET_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxPetLevel").getNodeValue()) + 1);
|
||||
|
||||
if (MAX_LEVEL > Config.PLAYER_MAXIMUM_LEVEL)
|
||||
{
|
||||
MAX_LEVEL = Config.PLAYER_MAXIMUM_LEVEL;
|
||||
}
|
||||
if (MAX_PET_LEVEL > MAX_LEVEL)
|
||||
{
|
||||
MAX_PET_LEVEL = MAX_LEVEL; // Pet level should not exceed owner level.
|
||||
}
|
||||
|
||||
int maxLevel = 0;
|
||||
for (Node n = table.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("experience".equals(n.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = n.getAttributes();
|
||||
_expTable.put(parseInteger(attrs, "level"), parseLong(attrs, "tolevel"));
|
||||
maxLevel = parseInteger(attrs, "level");
|
||||
if (maxLevel > Config.PLAYER_MAXIMUM_LEVEL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_expTable.put(maxLevel, parseLong(attrs, "tolevel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,6 +100,10 @@ public final class ExperienceData implements IGameXmlReader
|
||||
*/
|
||||
public long getExpForLevel(int level)
|
||||
{
|
||||
if (level > Config.PLAYER_MAXIMUM_LEVEL)
|
||||
{
|
||||
level = Config.PLAYER_MAXIMUM_LEVEL;
|
||||
}
|
||||
return _expTable.get(level);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
|
||||
/**
|
||||
@ -61,7 +62,12 @@ public class KarmaData implements IGameXmlReader
|
||||
if ("increase".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = d.getAttributes();
|
||||
_karmaTable.put(parseInteger(attrs, "lvl"), parseDouble(attrs, "val"));
|
||||
final int level = parseInteger(attrs, "lvl");
|
||||
if (level >= Config.PLAYER_MAXIMUM_LEVEL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_karmaTable.put(level, parseDouble(attrs, "val"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
@ -156,7 +157,7 @@ public final class PlayerTemplateData implements IGameXmlReader
|
||||
{
|
||||
final String nodeName = valNode.getNodeName();
|
||||
|
||||
if ((nodeName.startsWith("hp") || nodeName.startsWith("mp") || nodeName.startsWith("cp")) && _playerTemplates.containsKey(ClassId.getClassId(classId)))
|
||||
if ((level < Config.PLAYER_MAXIMUM_LEVEL) && (nodeName.startsWith("hp") || nodeName.startsWith("mp") || nodeName.startsWith("cp")) && _playerTemplates.containsKey(ClassId.getClassId(classId)))
|
||||
{
|
||||
_playerTemplates.get(ClassId.getClassId(classId)).setUpgainValue(nodeName, level, Double.parseDouble(valNode.getTextContent()));
|
||||
_dataCount++;
|
||||
@ -164,6 +165,7 @@ public final class PlayerTemplateData implements IGameXmlReader
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Generate stats automatically.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,12 @@ public final class PlayerXpPercentLostData implements IGameXmlReader
|
||||
if ("xpLost".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = d.getAttributes();
|
||||
_playerXpPercentLost[parseInteger(attrs, "level")] = parseDouble(attrs, "val");
|
||||
final Integer level = parseInteger(attrs, "level");
|
||||
if (level > _maxlevel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_playerXpPercentLost[level] = parseDouble(attrs, "val");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user