Implemented de-level minimum level config.

This commit is contained in:
MobiusDev 2015-11-14 18:52:22 +00:00
parent e38353e409
commit 97286edf6c
6 changed files with 26 additions and 18 deletions

View File

@ -14,6 +14,10 @@
# Default: True
Delevel = True
# Players will be affected by de-level after this level.
# Default: 85
DelevelMinimum = 85
# This option enable check for all player skills for skill level.
# If player level is lower than skill learn level - 9, skill level is decreased to next possible level.
# If there is no possible level, skill is removed from player.

View File

@ -77,17 +77,11 @@ public class AdminLevel implements IAdminCommandHandler
byte lvl = Byte.parseByte(val);
if ((lvl >= 1) && (lvl <= maxLevel))
{
long pXp = targetPlayer.getExp();
long tXp = ExperienceData.getInstance().getExpForLevel(lvl);
if (pXp > tXp)
{
targetPlayer.removeExpAndSp(pXp - tXp, 0);
}
else if (pXp < tXp)
{
targetPlayer.addExpAndSp(tXp - pXp, 0);
}
targetPlayer.setExp(ExperienceData.getInstance().getExpForLevel(lvl));
targetPlayer.getStat().setLevel(lvl);
targetPlayer.setCurrentHpMp(targetPlayer.getMaxHp(), targetPlayer.getMaxMp());
targetPlayer.setCurrentCp(targetPlayer.getMaxCp());
targetPlayer.broadcastUserInfo();
}
else
{

View File

@ -116,7 +116,8 @@ public final class Config
// --------------------------------------------------
// L2J Variable Definitions
// --------------------------------------------------
public static boolean ALT_GAME_DELEVEL;
public static boolean PLAYER_DELEVEL;
public static int DELEVEL_MINIMUM;
public static boolean DECREASE_SKILL_LEVEL;
public static double ALT_WEIGHT_LIMIT;
public static int RUN_SPD_BOOST;
@ -1396,7 +1397,8 @@ public final class Config
// Load Character L2Properties file (if exists)
final PropertiesParser character = new PropertiesParser(CHARACTER_CONFIG_FILE);
ALT_GAME_DELEVEL = character.getBoolean("Delevel", true);
PLAYER_DELEVEL = character.getBoolean("Delevel", true);
DELEVEL_MINIMUM = character.getInt("DelevelMinimum", 85);
DECREASE_SKILL_LEVEL = character.getBoolean("DecreaseSkillOnDelevel", true);
ALT_WEIGHT_LIMIT = character.getDouble("AltWeightLimit", 1);
RUN_SPD_BOOST = character.getInt("RunSpeedBoost", 0);
@ -3472,7 +3474,10 @@ public final class Config
ALT_PERFECT_SHLD_BLOCK = Integer.parseInt(pValue);
break;
case "delevel":
ALT_GAME_DELEVEL = Boolean.parseBoolean(pValue);
PLAYER_DELEVEL = Boolean.parseBoolean(pValue);
break;
case "DelevelMinimum":
DELEVEL_MINIMUM = Integer.parseInt(pValue);
break;
case "magicfailures":
ALT_GAME_MAGICFAILURES = Boolean.parseBoolean(pValue);

View File

@ -5839,7 +5839,7 @@ public final class L2PcInstance extends L2Playable
setExpBeforeDeath(getExp());
getStat().addExp(-lostExp);
getStat().removeExp(lostExp);
}
public boolean isPartyWaiting()

View File

@ -76,7 +76,7 @@ public class PcStat extends PlayableStat
@Override
public boolean addExp(long value)
{
L2PcInstance activeChar = getActiveChar();
final L2PcInstance activeChar = getActiveChar();
// Allowed to gain exp?
if (!getActiveChar().getAccessLevel().canGainExp())
@ -92,7 +92,7 @@ public class PcStat extends PlayableStat
// Set new karma
if (!activeChar.isCursedWeaponEquipped() && (activeChar.getReputation() < 0) && (activeChar.isGM() || !activeChar.isInsideZone(ZoneId.PVP)))
{
int karmaLost = Formulas.calculateKarmaLost(activeChar, value);
final int karmaLost = Formulas.calculateKarmaLost(activeChar, value);
if (karmaLost > 0)
{
activeChar.setReputation(activeChar.getReputation() + karmaLost);
@ -219,7 +219,7 @@ public class PcStat extends PlayableStat
public boolean removeExpAndSp(long addToExp, long addToSp, boolean sendMessage)
{
int level = getLevel();
final int level = getLevel();
if (!super.removeExpAndSp(addToExp, addToSp))
{
return false;

View File

@ -103,6 +103,11 @@ public class PlayableStat extends CharStat
public boolean removeExp(long value)
{
if (((getExp() - value) < getExpForLevel(getLevel())) && (!Config.PLAYER_DELEVEL || (Config.PLAYER_DELEVEL && (getLevel() <= Config.DELEVEL_MINIMUM))))
{
value = getExp() - getExpForLevel(getLevel());
}
if ((getExp() - value) < 0)
{
value = getExp() - 1;