From 8a422558c1a4526a7f91653e27e8e33bca23c891 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 29 Apr 2022 21:28:05 +0000 Subject: [PATCH] Addition of MaximumPlayerLevel configuration. --- .../dist/game/config/Character.ini | 6 ++++ .../java/org/l2jmobius/Config.java | 3 ++ .../gameserver/data/xml/ExperienceData.java | 36 ++++++++++++------- .../dist/game/config/Character.ini | 6 ++++ .../java/org/l2jmobius/Config.java | 3 ++ .../gameserver/data/xml/ExperienceData.java | 36 ++++++++++++------- .../dist/game/config/Character.ini | 6 ++++ .../java/org/l2jmobius/Config.java | 3 ++ .../gameserver/data/xml/ExperienceData.java | 36 ++++++++++++------- 9 files changed, 96 insertions(+), 39 deletions(-) diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/config/Character.ini b/L2J_Mobius_CT_0_Interlude/dist/game/config/Character.ini index 116ba8a47c..1c4c0af77f 100644 --- a/L2J_Mobius_CT_0_Interlude/dist/game/config/Character.ini +++ b/L2J_Mobius_CT_0_Interlude/dist/game/config/Character.ini @@ -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 diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java index ff60325b11..e4fd2477a3 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java @@ -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); diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java index 19090a84e2..201bd0f6a5 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java @@ -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 _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); } /** diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Character.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Character.ini index f5def71aa9..6715498118 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Character.ini +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Character.ini @@ -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 diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java index be54cfabff..e559564d1a 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java @@ -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); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java index 19090a84e2..201bd0f6a5 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java @@ -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 _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); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini index 8fb2ab3b4c..0ea1dd5714 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini @@ -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 diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java index 81bedb6ed8..e0db25ee3b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java index 19090a84e2..201bd0f6a5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/ExperienceData.java @@ -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 _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); } /**