Addition of MaximumPlayerLevel configuration.

This commit is contained in:
MobiusDevelopment 2022-04-29 21:28:05 +00:00
parent 00b6c008ce
commit 8a422558c1
9 changed files with 96 additions and 39 deletions

View File

@ -340,6 +340,12 @@ MaxAbnormalStateSuccessRate = 90
# Default: 2147483647
MaxSp = 2000000000
# Maximum Player Level
# WARNING: Cannot exceed the maximum experince.xml level.
# Example: Set as 78 to force the maximum player level at 78.
# Default: 80
MaximumPlayerLevel = 80
# Maximum number of allowed subclasses for every player.
# Default: 3
MaxSubclass = 3

View File

@ -207,6 +207,7 @@ public class Config
public static int MIN_ABNORMAL_STATE_SUCCESS_RATE;
public static int MAX_ABNORMAL_STATE_SUCCESS_RATE;
public static long MAX_SP;
public static byte PLAYER_MAXIMUM_LEVEL;
public static byte MAX_SUBCLASS;
public static byte BASE_SUBCLASS_LEVEL;
public static byte MAX_SUBCLASS_LEVEL;
@ -1719,6 +1720,8 @@ public class Config
MIN_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MinAbnormalStateSuccessRate", 10);
MAX_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MaxAbnormalStateSuccessRate", 90);
MAX_SP = characterConfig.getLong("MaxSp", 50000000000L) >= 0 ? characterConfig.getLong("MaxSp", 50000000000L) : Long.MAX_VALUE;
PLAYER_MAXIMUM_LEVEL = characterConfig.getByte("MaximumPlayerLevel", (byte) 80);
PLAYER_MAXIMUM_LEVEL++;
MAX_SUBCLASS = characterConfig.getByte("MaxSubclass", (byte) 3);
BASE_SUBCLASS_LEVEL = characterConfig.getByte("BaseSubclassLevel", (byte) 40);
MAX_SUBCLASS_LEVEL = characterConfig.getByte("MaxSubclassLevel", (byte) 80);

View File

@ -19,11 +19,13 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader;
/**
@ -32,6 +34,8 @@ import org.l2jmobius.commons.util.IXmlReader;
*/
public class ExperienceData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(ExperienceData.class.getName());
private final Map<Integer, Long> _expTable = new HashMap<>();
private byte MAX_LEVEL;
@ -62,12 +66,27 @@ public class ExperienceData implements IXmlReader
final NamedNodeMap tableAttr = table.getAttributes();
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"));
}
}
}
@ -79,20 +98,11 @@ public class ExperienceData implements IXmlReader
*/
public long getExpForLevel(int level)
{
if (level <= 0)
if (level > Config.PLAYER_MAXIMUM_LEVEL)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return 0;
return _expTable.get((int) Config.PLAYER_MAXIMUM_LEVEL);
}
final Long exp = _expTable.get(level);
if (exp == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return _expTable.get((int) MAX_LEVEL);
}
return exp.longValue();
return _expTable.get(level);
}
/**

View File

@ -344,6 +344,12 @@ MaxAbnormalStateSuccessRate = 90
# Default: 2147483647
MaxSp = 2000000000
# Maximum Player Level
# WARNING: Cannot exceed the maximum experince.xml level.
# Example: Set as 80 to force the maximum player level at 80.
# Default: 85
MaximumPlayerLevel = 85
# Maximum number of allowed subclasses for every player.
# Default: 3
MaxSubclass = 3

View File

@ -212,6 +212,7 @@ public class Config
public static int MIN_ABNORMAL_STATE_SUCCESS_RATE;
public static int MAX_ABNORMAL_STATE_SUCCESS_RATE;
public static long MAX_SP;
public static byte PLAYER_MAXIMUM_LEVEL;
public static byte MAX_SUBCLASS;
public static byte BASE_SUBCLASS_LEVEL;
public static byte MAX_SUBCLASS_LEVEL;
@ -1771,6 +1772,8 @@ public class Config
MIN_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MinAbnormalStateSuccessRate", 10);
MAX_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MaxAbnormalStateSuccessRate", 90);
MAX_SP = characterConfig.getLong("MaxSp", 50000000000L) >= 0 ? characterConfig.getLong("MaxSp", 50000000000L) : Long.MAX_VALUE;
PLAYER_MAXIMUM_LEVEL = characterConfig.getByte("MaximumPlayerLevel", (byte) 85);
PLAYER_MAXIMUM_LEVEL++;
MAX_SUBCLASS = characterConfig.getByte("MaxSubclass", (byte) 3);
BASE_SUBCLASS_LEVEL = characterConfig.getByte("BaseSubclassLevel", (byte) 40);
MAX_SUBCLASS_LEVEL = characterConfig.getByte("MaxSubclassLevel", (byte) 80);

View File

@ -19,11 +19,13 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader;
/**
@ -32,6 +34,8 @@ import org.l2jmobius.commons.util.IXmlReader;
*/
public class ExperienceData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(ExperienceData.class.getName());
private final Map<Integer, Long> _expTable = new HashMap<>();
private byte MAX_LEVEL;
@ -62,12 +66,27 @@ public class ExperienceData implements IXmlReader
final NamedNodeMap tableAttr = table.getAttributes();
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"));
}
}
}
@ -79,20 +98,11 @@ public class ExperienceData implements IXmlReader
*/
public long getExpForLevel(int level)
{
if (level <= 0)
if (level > Config.PLAYER_MAXIMUM_LEVEL)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return 0;
return _expTable.get((int) Config.PLAYER_MAXIMUM_LEVEL);
}
final Long exp = _expTable.get(level);
if (exp == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return _expTable.get((int) MAX_LEVEL);
}
return exp.longValue();
return _expTable.get(level);
}
/**

View File

@ -367,6 +367,12 @@ MaxAbnormalStateSuccessRate = 90
# Default: 2147483647
MaxSp = 2000000000
# Maximum Player Level
# WARNING: Cannot exceed the maximum experince.xml level.
# Example: Set as 80 to force the maximum player level at 80.
# Default: 85
MaximumPlayerLevel = 85
# Maximum number of allowed subclasses for every player.
# Default: 3
MaxSubclass = 3

View File

@ -213,6 +213,7 @@ public class Config
public static int MIN_ABNORMAL_STATE_SUCCESS_RATE;
public static int MAX_ABNORMAL_STATE_SUCCESS_RATE;
public static long MAX_SP;
public static byte PLAYER_MAXIMUM_LEVEL;
public static byte MAX_SUBCLASS;
public static byte BASE_SUBCLASS_LEVEL;
public static byte MAX_SUBCLASS_LEVEL;
@ -1772,6 +1773,8 @@ public class Config
MIN_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MinAbnormalStateSuccessRate", 10);
MAX_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MaxAbnormalStateSuccessRate", 90);
MAX_SP = characterConfig.getLong("MaxSp", 50000000000L) >= 0 ? characterConfig.getLong("MaxSp", 50000000000L) : Long.MAX_VALUE;
PLAYER_MAXIMUM_LEVEL = characterConfig.getByte("MaximumPlayerLevel", (byte) 85);
PLAYER_MAXIMUM_LEVEL++;
MAX_SUBCLASS = characterConfig.getByte("MaxSubclass", (byte) 3);
BASE_SUBCLASS_LEVEL = characterConfig.getByte("BaseSubclassLevel", (byte) 40);
MAX_SUBCLASS_LEVEL = characterConfig.getByte("MaxSubclassLevel", (byte) 80);

View File

@ -19,11 +19,13 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader;
/**
@ -32,6 +34,8 @@ import org.l2jmobius.commons.util.IXmlReader;
*/
public class ExperienceData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(ExperienceData.class.getName());
private final Map<Integer, Long> _expTable = new HashMap<>();
private byte MAX_LEVEL;
@ -62,12 +66,27 @@ public class ExperienceData implements IXmlReader
final NamedNodeMap tableAttr = table.getAttributes();
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"));
}
}
}
@ -79,20 +98,11 @@ public class ExperienceData implements IXmlReader
*/
public long getExpForLevel(int level)
{
if (level <= 0)
if (level > Config.PLAYER_MAXIMUM_LEVEL)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return 0;
return _expTable.get((int) Config.PLAYER_MAXIMUM_LEVEL);
}
final Long exp = _expTable.get(level);
if (exp == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return _expTable.get((int) MAX_LEVEL);
}
return exp.longValue();
return _expTable.get(level);
}
/**