Use PropertiesParser for reading configurations.

This commit is contained in:
MobiusDevelopment 2020-02-19 12:13:21 +00:00
parent faa853de6b
commit dfddf3f519
25 changed files with 2279 additions and 2507 deletions

View File

@ -18,7 +18,7 @@ ChampionMaxLevel = 70
ChampionHp = 8
# Hp Regen Multiplier.
ChampionRegenHp = 1.
ChampionHpRegen = 1.
# Rewards multiplier.
ChampionRewards = 8

View File

@ -5,6 +5,7 @@
# ----------------------------------------
# Teleport Function price
# ----------------------------------------
ClanHallTeleportFunctionFeeRation = 86400000
# 1st level
ClanHallTeleportFunctionFeeLvl1 = 7000
# 2nd level
@ -19,6 +20,7 @@ ClanHallTeleportFunctionFeeLvl2 = 14000
# -------------------------------------------
# Support magic buff price
# -------------------------------------------
ClanHallSupportFunctionFeeRation = 86400000
# 1st level
ClanHallSupportFeeLvl1 = 17500
# 2nd level
@ -39,6 +41,7 @@ ClanHallSupportFeeLvl8 = 364000
# ---------------------------------------
# MpRegeneration price
# ---------------------------------------
ClanHallMpRegenerationFunctionFeeRation = 86400000
# 5% MpRegeneration
ClanHallMpRegenerationFeeLvl1 = 14000
# 10% MpRegeneration
@ -53,6 +56,7 @@ ClanHallMpRegenerationFeeLvl5 = 140000
# --------------------------------------
# HpRegeneration price
# --------------------------------------
ClanHallHpRegenerationFunctionFeeRation = 86400000
# 20% HpRegeneration
ClanHallHpRegenerationFeeLvl1 = 4900
# 40% HpRegeneration
@ -83,6 +87,7 @@ ClanHallHpRegenerationFeeLvl13 = 36166
# ----------------------------------------
# ExpRegeneration price
# ----------------------------------------
ClanHallExpRegenerationFunctionFeeRation = 86400000
# 5% ExpRegeneration
ClanHallExpRegenerationFeeLvl1 = 21000
# 10% ExpRegeneration
@ -101,6 +106,7 @@ ClanHallExpRegenerationFeeLvl7 = 210000
# --------------------------------------
# Creation item function
# --------------------------------------
ClanHallItemCreationFunctionFeeRation = 86400000
# Time after count of Item is restored (in Hours)
# ClanHallItemCreationFunctionTaskRestore = 24
# 1st level
@ -115,7 +121,9 @@ ClanHallItemCreationFunctionFeeLvl3 = 980000
# --------------------------
# Need core support, need more information on functions in different
# Clan Hall in different Towns.
ClanHallCurtainFunctionFeeRation = 86400000
ClanHallCurtainFunctionFeeLvl1 = 2002
ClanHallCurtainFunctionFeeLvl2 = 2625
ClanHallFrontPlatformFunctionFeeRation = 86400000
ClanHallFrontPlatformFunctionFeeLvl1 = 3031
ClanHallFrontPlatformFunctionFeeLvl2 = 9331

View File

@ -5,16 +5,16 @@
# ---------------------------------------------------------------------------
# Debug
# ---------------------------------------------------------------------------
# Don't load quests
# Do not load quests
AltDevNoQuests = False
# Don't load spawntable
# Do not load spawntable
AltDevNoSpawns = False
# Don't load Script's
# Do not load Scripts
AltDevNoScript = False
# Don't load RaidBoss
# Do not load RaidBoss
AltDevNoRB = False

View File

@ -55,5 +55,4 @@ AltFestivalSecondSwarm = 720000
# Spawn Chests.
# Default: 15 minutes
AltFestivalChestspawn = 900000
AltFestivalChestSpawn = 900000

View File

@ -141,6 +141,13 @@ FloodProtectorMoveActionPunishmentLimit = 0
FloodProtectorMoveActionPunishmentType = none
FloodProtectorMoveActionPunishmentTime = 0
# Generic Action
FloodProtectorGenericActionInterval = 5
FloodProtectorGenericActionLogFlooding = false
FloodProtectorGenericActionPunishmentLimit = 0
FloodProtectorGenericActionPunishmentType = none
FloodProtectorGenericActionPunishmentTime = 0
# Macro - attempts to Macro system
FloodProtectorMacroInterval = 8
FloodProtectorMacroLogFlooding = True

File diff suppressed because it is too large Load Diff

View File

@ -26,58 +26,52 @@ public class ClassMasterSettings
private final Map<Integer, Map<Integer, Integer>> _rewardItems;
private final Map<Integer, Boolean> _allowedClassChange;
public ClassMasterSettings(String _configLine)
public ClassMasterSettings(String configLine)
{
_claimItems = new HashMap<>();
_rewardItems = new HashMap<>();
_allowedClassChange = new HashMap<>();
if (_configLine != null)
if (configLine != null)
{
parseConfigLine(_configLine.trim());
parseConfigLine(configLine.trim());
}
}
private void parseConfigLine(String _configLine)
private void parseConfigLine(String configLine)
{
final StringTokenizer st = new StringTokenizer(_configLine, ";");
final StringTokenizer st = new StringTokenizer(configLine, ";");
while (st.hasMoreTokens())
{
final int job = Integer.parseInt(st.nextToken());
_allowedClassChange.put(job, true);
Map<Integer, Integer> _items = new HashMap<>();
Map<Integer, Integer> items = new HashMap<>();
if (st.hasMoreTokens())
{
final StringTokenizer st2 = new StringTokenizer(st.nextToken(), "[],");
while (st2.hasMoreTokens())
{
final StringTokenizer st3 = new StringTokenizer(st2.nextToken(), "()");
final int _itemId = Integer.parseInt(st3.nextToken());
final int _quantity = Integer.parseInt(st3.nextToken());
_items.put(_itemId, _quantity);
final int itemId = Integer.parseInt(st3.nextToken());
final int quantity = Integer.parseInt(st3.nextToken());
items.put(itemId, quantity);
}
}
_claimItems.put(job, items);
_claimItems.put(job, _items);
_items = new HashMap<>();
items = new HashMap<>();
if (st.hasMoreTokens())
{
final StringTokenizer st2 = new StringTokenizer(st.nextToken(), "[],");
while (st2.hasMoreTokens())
{
final StringTokenizer st3 = new StringTokenizer(st2.nextToken(), "()");
final int _itemId = Integer.parseInt(st3.nextToken());
final int _quantity = Integer.parseInt(st3.nextToken());
_items.put(_itemId, _quantity);
final int itemId = Integer.parseInt(st3.nextToken());
final int quantity = Integer.parseInt(st3.nextToken());
items.put(itemId, quantity);
}
}
_rewardItems.put(job, _items);
_rewardItems.put(job, items);
}
}

View File

@ -1,161 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 org.l2jmobius.commons.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Properties;
import java.util.logging.Logger;
import org.l2jmobius.Config;
public class L2Properties extends Properties
{
protected static final Logger LOGGER = Logger.getLogger(Config.class.getName());
private boolean _warn = false;
public L2Properties()
{
}
public L2Properties setLog(boolean warn)
{
_warn = warn;
return this;
}
public L2Properties(String name) throws IOException
{
load(new FileInputStream(name));
}
public L2Properties(File file) throws IOException
{
load(new FileInputStream(file));
}
public L2Properties(InputStream inStream)
{
load(inStream);
}
public L2Properties(Reader reader)
{
load(reader);
}
public void load(String name) throws IOException
{
load(new FileInputStream(name));
}
public void load(File file) throws IOException
{
load(new FileInputStream(file));
}
@Override
public synchronized void load(InputStream inStream)
{
try
{
super.load(inStream);
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (inStream != null)
{
try
{
inStream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
@Override
public synchronized void load(Reader reader)
{
try
{
super.load(reader);
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (reader != null)
{
try
{
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
@Override
public String getProperty(String key)
{
final String property = super.getProperty(key);
if (property == null)
{
if (_warn)
{
LOGGER.warning("L2Properties: Missing property for key - " + key);
}
return null;
}
return property.trim();
}
@Override
public String getProperty(String key, String defaultValue)
{
final String property = super.getProperty(key, defaultValue);
if (property == null)
{
if (_warn)
{
LOGGER.warning("L2Properties: Missing defaultValue for key - " + key);
}
return null;
}
return property.trim();
}
}

View File

@ -0,0 +1,381 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 org.l2jmobius.commons.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
/**
* Simplifies loading of property files and adds logging if a non existing property is requested.
* @author NosBit
*/
public class PropertiesParser
{
private static final Logger LOGGER = Logger.getLogger(PropertiesParser.class.getName());
private final Properties _properties = new Properties();
private final File _file;
public PropertiesParser(String name)
{
this(new File(name));
}
public PropertiesParser(File file)
{
_file = file;
try (FileInputStream fileInputStream = new FileInputStream(file))
{
try (InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, Charset.defaultCharset()))
{
_properties.load(inputStreamReader);
}
}
catch (Exception e)
{
LOGGER.warning("[" + _file.getName() + "] There was an error loading config reason: " + e.getMessage());
}
}
public boolean containskey(String key)
{
return _properties.containsKey(key);
}
private String getValue(String key)
{
final String value = _properties.getProperty(key);
return value != null ? value.trim() : null;
}
public boolean getBoolean(String key, boolean defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
if (value.equalsIgnoreCase("true"))
{
return true;
}
else if (value.equalsIgnoreCase("false"))
{
return false;
}
else
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"boolean\" using default value: " + defaultValue);
return defaultValue;
}
}
public byte getByte(String key, byte defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Byte.parseByte(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"byte\" using default value: " + defaultValue);
return defaultValue;
}
}
public short getShort(String key, short defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Short.parseShort(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"short\" using default value: " + defaultValue);
return defaultValue;
}
}
public int getInt(String key, int defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"int\" using default value: " + defaultValue);
return defaultValue;
}
}
public long getLong(String key, long defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Long.parseLong(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"long\" using default value: " + defaultValue);
return defaultValue;
}
}
public float getFloat(String key, float defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Float.parseFloat(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"float\" using default value: " + defaultValue);
return defaultValue;
}
}
public double getDouble(String key, double defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Double.parseDouble(value);
}
catch (NumberFormatException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"double\" using default value: " + defaultValue);
return defaultValue;
}
}
public String getString(String key, String defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
return value;
}
public <T extends Enum<T>> T getEnum(String key, Class<T> clazz, T defaultValue)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
try
{
return Enum.valueOf(clazz, value);
}
catch (IllegalArgumentException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be enum value of \"" + clazz.getSimpleName() + "\" using default value: " + defaultValue);
return defaultValue;
}
}
/**
* @param durationPattern
* @param defaultValue
* @return {@link Duration} object by the durationPattern specified, {@code null} in case of malformed pattern.
*/
public Duration getDuration(String durationPattern, String defaultValue)
{
return getDuration(durationPattern, defaultValue, null);
}
/**
* @param durationPattern
* @param defaultValue
* @param defaultDuration
* @return {@link Duration} object by the durationPattern specified, the defaultDuration in case of malformed pattern.
*/
public Duration getDuration(String durationPattern, String defaultValue, Duration defaultDuration)
{
final String value = getString(durationPattern, defaultValue);
try
{
return TimeUtil.parseDuration(value);
}
catch (IllegalStateException e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + durationPattern + " specified value: " + value + " should be time patttern using default value: " + defaultValue);
}
return defaultDuration;
}
/**
* @param key
* @param separator
* @param defaultValues
* @return int array
*/
public int[] getIntArray(String key, String separator, int... defaultValues)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValues);
return defaultValues;
}
try
{
final String[] data = value.trim().split(separator);
final int[] result = new int[data.length];
for (int i = 0; i < data.length; i++)
{
result[i] = Integer.decode(data[i].trim());
}
return result;
}
catch (Exception e)
{
LOGGER.warning("[+_file.getName()+] Invalid value specified for key: " + key + " specified value: " + value + " should be array using default value: " + defaultValues);
return defaultValues;
}
}
/**
* @param <T>
* @param key
* @param separator
* @param clazz
* @param defaultValues
* @return enum array
*/
@SafeVarargs
public final <T extends Enum<T>> T[] getEnumArray(String key, String separator, Class<T> clazz, T... defaultValues)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValues);
return defaultValues;
}
try
{
final String[] data = value.trim().split(separator);
@SuppressWarnings("unchecked")
final T[] result = (T[]) Array.newInstance(clazz, data.length);
for (int i = 0; i < data.length; i++)
{
result[i] = Enum.valueOf(clazz, data[i]);
}
return result;
}
catch (Exception e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be array using default value: " + defaultValues);
return defaultValues;
}
}
/**
* @param <T>
* @param key
* @param separator
* @param clazz
* @param defaultValues
* @return list
*/
@SafeVarargs
public final <T extends Enum<T>> List<T> getEnumList(String key, String separator, Class<T> clazz, T... defaultValues)
{
final String value = getValue(key);
if (value == null)
{
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValues);
return Arrays.asList(defaultValues);
}
try
{
final String[] data = value.trim().split(separator);
final List<T> result = new ArrayList<>(data.length);
for (String element : data)
{
result.add(Enum.valueOf(clazz, element));
}
return result;
}
catch (Exception e)
{
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be array using default value: " + defaultValues);
return Arrays.asList(defaultValues);
}
}
}

View File

@ -407,7 +407,7 @@ public class GameServer
LOGGER.info("IdFactory: Free ObjectID's remaining: " + IdFactory.size());
if (Config.L2JMOD_ALLOW_WEDDING)
if (Config.ALLOW_WEDDING)
{
CoupleManager.getInstance();
}

View File

@ -292,7 +292,7 @@ public class ManorSeedData implements IXmlReader
final SeedDataHolder seed = _seeds.get(seedId);
if (seed != null)
{
return seed.getSeedLimit();
return (int) seed.getSeedLimit();
}
return 0;
}
@ -303,7 +303,7 @@ public class ManorSeedData implements IXmlReader
{
if (seed.getCropId() == cropId)
{
return seed.getCropLimit();
return (int) seed.getCropLimit();
}
}
return 0;

View File

@ -61,7 +61,7 @@ public class VoicedCommandHandler
registerVoicedCommandHandler(new DMCmd());
}
if (Config.L2JMOD_ALLOW_WEDDING)
if (Config.ALLOW_WEDDING)
{
registerVoicedCommandHandler(new Wedding());
}

View File

@ -141,9 +141,9 @@ public class AdminKill implements IAdminCommandHandler
target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar);
}
else if (Config.L2JMOD_CHAMPION_ENABLE && target.isChampion())
else if (Config.CHAMPION_ENABLE && target.isChampion())
{
target.reduceCurrentHp((target.getMaxHp() * Config.L2JMOD_CHAMPION_HP) + 1, activeChar);
target.reduceCurrentHp((target.getMaxHp() * Config.CHAMPION_HP) + 1, activeChar);
}
else
{

View File

@ -269,9 +269,9 @@ public class AdminMenu implements IAdminCommandHandler
target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar);
filename = "charmanage.htm";
}
else if (Config.L2JMOD_CHAMPION_ENABLE && target.isChampion())
else if (Config.CHAMPION_ENABLE && target.isChampion())
{
target.reduceCurrentHp((target.getMaxHp() * Config.L2JMOD_CHAMPION_HP) + 1, activeChar);
target.reduceCurrentHp((target.getMaxHp() * Config.CHAMPION_HP) + 1, activeChar);
}
else
{

View File

@ -93,7 +93,7 @@ public class Wedding implements IVoicedCommandHandler
if (activeChar.isMarried())
{
activeChar.sendMessage("You are now divorced.");
adenaAmount = (activeChar.getAdena() / 100) * Config.L2JMOD_WEDDING_DIVORCE_COSTS;
adenaAmount = (activeChar.getAdena() / 100) * Config.WEDDING_DIVORCE_COSTS;
activeChar.getInventory().reduceAdena("Wedding", adenaAmount, activeChar, null);
}
else
@ -150,7 +150,7 @@ public class Wedding implements IVoicedCommandHandler
{
activeChar.sendMessage("You are already engaged.");
if (Config.L2JMOD_WEDDING_PUNISH_INFIDELITY)
if (Config.WEDDING_PUNISH_INFIDELITY)
{
activeChar.startAbnormalEffect((short) 0x2000); // give player a Big Head
// lets recycle the sevensigns debuffs
@ -208,7 +208,7 @@ public class Wedding implements IVoicedCommandHandler
return false;
}
if ((ptarget.getAppearance().isFemale() == activeChar.getAppearance().isFemale()) && !Config.L2JMOD_WEDDING_SAMESEX)
if ((ptarget.getAppearance().isFemale() == activeChar.getAppearance().isFemale()) && !Config.WEDDING_SAMESEX)
{
activeChar.sendMessage("Gay marriage is not allowed on this server!");
return false;
@ -379,10 +379,10 @@ public class Wedding implements IVoicedCommandHandler
return false;
}
final int teleportTimer = Config.L2JMOD_WEDDING_TELEPORT_DURATION * 1000;
final int teleportTimer = Config.WEDDING_TELEPORT_DURATION * 1000;
activeChar.sendMessage("After " + (teleportTimer / 60000) + " min. you will be teleported to your fiance.");
activeChar.getInventory().reduceAdena("Wedding", Config.L2JMOD_WEDDING_TELEPORT_PRICE, activeChar, null);
activeChar.getInventory().reduceAdena("Wedding", Config.WEDDING_TELEPORT_PRICE, activeChar, null);
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
// SoE Animation section

View File

@ -565,10 +565,10 @@ public class Attackable extends NpcInstance
}
setChampion(false);
if (Config.L2JMOD_CHAMPION_ENABLE)
if (Config.CHAMPION_ENABLE)
{
// Set champion on next spawn.
if (!(this instanceof GrandBossInstance) && !(this instanceof RaidBossInstance) && (this instanceof MonsterInstance) /* && !getTemplate().isQuestMonster */ && (Config.L2JMOD_CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.L2JMOD_CHAMP_MIN_LVL) && (getLevel() <= Config.L2JMOD_CHAMP_MAX_LVL) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_FREQUENCY))
if (!(this instanceof GrandBossInstance) && !(this instanceof RaidBossInstance) && (this instanceof MonsterInstance) /* && !getTemplate().isQuestMonster */ && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LVL) && (getLevel() <= Config.CHAMP_MAX_LVL) && (Rnd.get(100) < Config.CHAMPION_FREQUENCY))
{
setChampion(true);
}
@ -773,10 +773,10 @@ public class Attackable extends NpcInstance
exp *= 1 - penalty;
sp = tmp[1];
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
if (Config.CHAMPION_ENABLE && isChampion())
{
exp *= Config.L2JMOD_CHAMPION_REWARDS;
sp *= Config.L2JMOD_CHAMPION_REWARDS;
exp *= Config.CHAMPION_REWARDS;
sp *= Config.CHAMPION_REWARDS;
}
// Check for an over-hit enabled strike and Donator options
@ -917,10 +917,10 @@ public class Attackable extends NpcInstance
exp = tmp[0];
sp = tmp[1];
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
if (Config.CHAMPION_ENABLE && isChampion())
{
exp *= Config.L2JMOD_CHAMPION_REWARDS;
sp *= Config.L2JMOD_CHAMPION_REWARDS;
exp *= Config.CHAMPION_REWARDS;
sp *= Config.CHAMPION_REWARDS;
}
exp *= partyMul;
@ -1395,9 +1395,9 @@ public class Attackable extends NpcInstance
}
}
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
if (Config.CHAMPION_ENABLE && isChampion())
{
dropChance *= Config.L2JMOD_CHAMPION_REWARDS;
dropChance *= Config.CHAMPION_REWARDS;
}
// Round drop chance
@ -1457,9 +1457,9 @@ public class Attackable extends NpcInstance
// Prepare for next iteration if dropChance > DropData.MAX_CHANCE
dropChance -= DropData.MAX_CHANCE;
}
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion() && ((drop.getItemId() == 57) || ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))))
if (Config.CHAMPION_ENABLE && isChampion() && ((drop.getItemId() == 57) || ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))))
{
itemCount *= Config.L2JMOD_CHAMPION_ADENAS_REWARDS;
itemCount *= Config.CHAMPION_ADENAS_REWARDS;
}
if ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))
@ -1555,9 +1555,9 @@ public class Attackable extends NpcInstance
categoryDropChance *= Config.RATE_DROP_ITEMS;
}
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
if (Config.CHAMPION_ENABLE && isChampion())
{
categoryDropChance *= Config.L2JMOD_CHAMPION_REWARDS;
categoryDropChance *= Config.CHAMPION_REWARDS;
}
// Set our limits for chance of drop
@ -1690,9 +1690,9 @@ public class Attackable extends NpcInstance
}
}
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
if (Config.CHAMPION_ENABLE && isChampion())
{
dropChance *= Config.L2JMOD_CHAMPION_REWARDS;
dropChance *= Config.CHAMPION_REWARDS;
}
if (dropChance < DropData.MAX_CHANCE)
@ -1750,9 +1750,9 @@ public class Attackable extends NpcInstance
// Prepare for next iteration if dropChance > DropData.MAX_CHANCE
dropChance -= DropData.MAX_CHANCE;
}
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion() && ((drop.getItemId() == 57) || ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))))
if (Config.CHAMPION_ENABLE && isChampion() && ((drop.getItemId() == 57) || ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))))
{
itemCount *= Config.L2JMOD_CHAMPION_ADENAS_REWARDS;
itemCount *= Config.CHAMPION_ADENAS_REWARDS;
}
if ((drop.getItemId() >= 6360) && (drop.getItemId() <= 6362))
@ -1937,13 +1937,13 @@ public class Attackable extends NpcInstance
}
// Apply Special Item drop with rnd qty for champions
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion() && (player.getLevel() <= (getLevel() + 3)) && (Config.L2JMOD_CHAMPION_REWARD > 0) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_REWARD))
if (Config.CHAMPION_ENABLE && isChampion() && (player.getLevel() <= (getLevel() + 3)) && (Config.CHAMPION_REWARD > 0) && (Rnd.get(100) < Config.CHAMPION_REWARD))
{
int champqty = Rnd.get(Config.L2JMOD_CHAMPION_REWARD_QTY);
int champqty = Rnd.get(Config.CHAMPION_REWARD_QTY);
champqty++; // quantity should actually vary between 1 and whatever admin specified as max, inclusive.
// Give this or these Item(s) to the PlayerInstance that has killed the Attackable
final RewardItem item = new RewardItem(Config.L2JMOD_CHAMPION_REWARD_ID, champqty);
final RewardItem item = new RewardItem(Config.CHAMPION_REWARD_ID, champqty);
if (Config.AUTO_LOOT)
{
final Item itemTemplate = ItemTable.getInstance().getTemplate(item.getItemId());
@ -3166,7 +3166,7 @@ public class Attackable extends NpcInstance
final List<RewardItem> harvested = new ArrayList<>();
harvested.add(new RewardItem(ManorSeedData.getInstance().getCropType(_seedType), count * Config.RATE_DROP_MANOR));
harvested.add(new RewardItem(ManorSeedData.getInstance().getCropType(_seedType), (int) (count * Config.RATE_DROP_MANOR)));
_harvestItems = harvested.toArray(new RewardItem[harvested.size()]);
}

View File

@ -9460,9 +9460,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
return;
}
if (Config.L2JMOD_CHAMPION_ENABLE && _champion && (Config.L2JMOD_CHAMPION_HP != 0))
if (Config.CHAMPION_ENABLE && _champion && (Config.CHAMPION_HP != 0))
{
getStatus().reduceHp(i / Config.L2JMOD_CHAMPION_HP, attacker, awake);
getStatus().reduceHp(i / Config.CHAMPION_HP, attacker, awake);
}
else if (_advanceFlag)
{

View File

@ -11751,15 +11751,15 @@ public class PlayerInstance extends Playable
{
if (marriedType() == 1)
{
getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_LESBO);
getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_LESBO);
}
else if (marriedType() == 2)
{
getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_GEY);
getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_GEY);
}
else
{
getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_NORMAL);
getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_NORMAL);
}
}

View File

@ -86,7 +86,7 @@ public class WeddingManagerInstance extends NpcInstance
private void showMessageWindow(PlayerInstance player)
{
final String filename = "data/html/mods/Wedding_start.htm";
final String replace = String.valueOf(Config.L2JMOD_WEDDING_PRICE);
final String replace = String.valueOf(Config.WEDDING_PRICE);
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(filename);
@ -141,20 +141,20 @@ public class WeddingManagerInstance extends NpcInstance
int type;
if (player.getAppearance().isFemale() && ptarget.getAppearance().isFemale())
{
player.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_LESBO);
ptarget.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_LESBO);
player.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_LESBO);
ptarget.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_LESBO);
type = 1;
}
else if (!player.getAppearance().isFemale() && !ptarget.getAppearance().isFemale())
{
player.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_GEY);
ptarget.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_GEY);
player.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_GEY);
ptarget.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_GEY);
type = 2;
}
else
{
player.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_NORMAL);
ptarget.getAppearance().setNameColor(Config.L2JMOD_WEDDING_NAME_COLOR_NORMAL);
player.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_NORMAL);
ptarget.getAppearance().setNameColor(Config.WEDDING_NAME_COLOR_NORMAL);
type = 0;
}
@ -171,7 +171,7 @@ public class WeddingManagerInstance extends NpcInstance
ptarget.setMaryRequest(false);
ptarget.setmarriedType(type);
if (Config.WEDDING_GIVE_CUPID_BOW)
if (Config.GIVE_CUPID_BOW)
{
player.addItem("Cupids Bow", 9140, 1, player, true);
player.getInventory().updateDatabase();
@ -230,7 +230,7 @@ public class WeddingManagerInstance extends NpcInstance
else if (player.isMaryRequest())
{
// check for formalwear
if (Config.L2JMOD_WEDDING_FORMALWEAR)
if (Config.WEDDING_FORMALWEAR)
{
final Inventory inv3 = player.getInventory();
final ItemInstance item3 = inv3.getPaperdollItem(10);
@ -247,7 +247,7 @@ public class WeddingManagerInstance extends NpcInstance
}
}
if (Config.L2JMOD_WEDDING_FORMALWEAR && !player.isWearingFormalWear())
if (Config.WEDDING_FORMALWEAR && !player.isWearingFormalWear())
{
filename = "data/html/mods/Wedding_noformal.htm";
sendHtmlMessage(player, filename, replace);
@ -264,7 +264,7 @@ public class WeddingManagerInstance extends NpcInstance
else if (command.startsWith("AskWedding"))
{
// check for formalwear
if (Config.L2JMOD_WEDDING_FORMALWEAR)
if (Config.WEDDING_FORMALWEAR)
{
final Inventory inv3 = player.getInventory();
final ItemInstance item3 = inv3.getPaperdollItem(10);
@ -282,16 +282,16 @@ public class WeddingManagerInstance extends NpcInstance
}
}
if (Config.L2JMOD_WEDDING_FORMALWEAR && !player.isWearingFormalWear())
if (Config.WEDDING_FORMALWEAR && !player.isWearingFormalWear())
{
filename = "data/html/mods/Wedding_noformal.htm";
sendHtmlMessage(player, filename, replace);
return;
}
else if (player.getAdena() < Config.L2JMOD_WEDDING_PRICE)
else if (player.getAdena() < Config.WEDDING_PRICE)
{
filename = "data/html/mods/Wedding_adena.htm";
replace = String.valueOf(Config.L2JMOD_WEDDING_PRICE);
replace = String.valueOf(Config.WEDDING_PRICE);
sendHtmlMessage(player, filename, replace);
return;
}
@ -301,7 +301,7 @@ public class WeddingManagerInstance extends NpcInstance
ptarget.setMaryRequest(true);
replace = ptarget.getName();
filename = "data/html/mods/Wedding_requested.htm";
player.getInventory().reduceAdena("Wedding", Config.L2JMOD_WEDDING_PRICE, player, player.getLastFolkNPC());
player.getInventory().reduceAdena("Wedding", Config.WEDDING_PRICE, player, player.getLastFolkNPC());
sendHtmlMessage(player, filename, replace);
return;
}

View File

@ -368,9 +368,9 @@ public class CreatureStat
float bonusAtk = 1;
if (Config.L2JMOD_CHAMPION_ENABLE && _creature.isChampion())
if (Config.CHAMPION_ENABLE && _creature.isChampion())
{
bonusAtk = Config.L2JMOD_CHAMPION_ATK;
bonusAtk = Config.CHAMPION_ATK;
}
double attack = _creature.getTemplate().getBaseMAtk() * bonusAtk;
@ -478,9 +478,9 @@ public class CreatureStat
float bonusSpdAtk = 1;
if (Config.L2JMOD_CHAMPION_ENABLE && _creature.isChampion())
if (Config.CHAMPION_ENABLE && _creature.isChampion())
{
bonusSpdAtk = Config.L2JMOD_CHAMPION_SPD_ATK;
bonusSpdAtk = Config.CHAMPION_SPD_ATK;
}
double val = calcStat(Stat.MAGIC_ATTACK_SPEED, _creature.getTemplate().getBaseMAtkSpd() * bonusSpdAtk, null, null);
@ -644,9 +644,9 @@ public class CreatureStat
float bonusAtk = 1;
if (Config.L2JMOD_CHAMPION_ENABLE && _creature.isChampion())
if (Config.CHAMPION_ENABLE && _creature.isChampion())
{
bonusAtk = Config.L2JMOD_CHAMPION_ATK;
bonusAtk = Config.CHAMPION_ATK;
}
return (int) calcStat(Stat.POWER_ATTACK, _creature.getTemplate().getBasePAtk() * bonusAtk, target, null);
@ -725,9 +725,9 @@ public class CreatureStat
float bonusAtk = 1;
if (Config.L2JMOD_CHAMPION_ENABLE && _creature.isChampion())
if (Config.CHAMPION_ENABLE && _creature.isChampion())
{
bonusAtk = Config.L2JMOD_CHAMPION_SPD_ATK;
bonusAtk = Config.CHAMPION_SPD_ATK;
}
double val = calcStat(Stat.POWER_ATTACK_SPEED, _creature.getTemplate().getBasePAtkSpd() * bonusAtk, null, null);

View File

@ -83,12 +83,12 @@ public class SeedDataHolder
return _isAlternative;
}
public int getSeedLimit()
public float getSeedLimit()
{
return _seedLimit * Config.RATE_DROP_MANOR;
}
public int getCropLimit()
public float getCropLimit()
{
return _cropLimit * Config.RATE_DROP_MANOR;
}

View File

@ -1003,9 +1003,9 @@ public class Formulas
double hpRegenMultiplier = creature.isRaid() ? Config.RAID_HP_REGEN_MULTIPLIER : Config.HP_REGEN_MULTIPLIER;
double hpRegenBonus = 0;
if (Config.L2JMOD_CHAMPION_ENABLE && creature.isChampion())
if (Config.CHAMPION_ENABLE && creature.isChampion())
{
hpRegenMultiplier *= Config.L2JMOD_CHAMPION_HP_REGEN;
hpRegenMultiplier *= Config.CHAMPION_HP_REGEN;
}
if (creature instanceof PlayerInstance)

View File

@ -69,7 +69,7 @@ public class DlgAnswer extends GameClientPacket
{
player.gatesAnswer(_answer, 0);
}
else if ((_messageId == 614) && Config.L2JMOD_ALLOW_WEDDING)
else if ((_messageId == 614) && Config.ALLOW_WEDDING)
{
player.EngageAnswer(_answer);
}

View File

@ -144,7 +144,7 @@ public class EnterWorld extends GameClientPacket
player.broadcastKarma(); // include UserInfo
// Engage and notify Partner
if (Config.L2JMOD_ALLOW_WEDDING)
if (Config.ALLOW_WEDDING)
{
engage(player);
notifyPartner(player);

View File

@ -83,9 +83,9 @@ public class NpcInfo extends GameServerPacket
_name = cha.getTemplate().getName();
}
if (Config.L2JMOD_CHAMPION_ENABLE && cha.isChampion())
if (Config.CHAMPION_ENABLE && cha.isChampion())
{
_title = Config.L2JMOD_CHAMP_TITLE;
_title = Config.CHAMP_TITLE;
}
else if (cha.getTemplate().isServerSideTitle())
{
@ -122,7 +122,7 @@ public class NpcInfo extends GameServerPacket
{
t1 += " " + _title;
}
_title = cha.isChampion() ? Config.L2JMOD_CHAMP_TITLE + " " + t1 : t1;
_title = cha.isChampion() ? Config.CHAMP_TITLE + " " + t1 : t1;
}
_x = _creature.getX();