/**
* Method loadServerConfig.
*/
public static void loadServerConfig()
{
ExProperties serverSettings = load(CONFIGURATION_FILE);
GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("LoginHost", "127.0.0.1");
GAME_SERVER_LOGIN_PORT = serverSettings.getProperty("LoginPort", 9013);
GAME_SERVER_LOGIN_CRYPT = serverSettings.getProperty("LoginUseCrypt", true);
LOGIN_SERVER_AGE_LIMIT = serverSettings.getProperty("ServerAgeLimit", 0);
LOGIN_SERVER_GM_ONLY = serverSettings.getProperty("ServerGMOnly", false);
LOGIN_SERVER_BRACKETS = serverSettings.getProperty("ServerBrackets", false);
LOGIN_SERVER_IS_PVP = serverSettings.getProperty("PvPServer", false);
for (String a : serverSettings.getProperty("ServerType", ArrayUtils.EMPTY_STRING_ARRAY))
{
if (a.trim().isEmpty())
{
continue;
}
ServerType t = ServerType.valueOf(a.toUpperCase());
LOGIN_SERVER_SERVER_TYPE |= t.getMask();
}
INTERNAL_HOSTNAME = serverSettings.getProperty("InternalHostname", "*");
EXTERNAL_HOSTNAME = serverSettings.getProperty("ExternalHostname", "*");
REQUEST_ID = serverSettings.getProperty("RequestServerID", 0);
ACCEPT_ALTERNATE_ID = serverSettings.getProperty("AcceptAlternateID", true);
GAMESERVER_HOSTNAME = serverSettings.getProperty("GameserverHostname");
PORTS_GAME = serverSettings.getProperty("GameserverPort", new int[]
{
7777
});
EVERYBODY_HAS_ADMIN_RIGHTS = serverSettings.getProperty("EverybodyHasAdminRights", false);
SECOND_AUTH_ENABLED = serverSettings.getProperty("SecondAuth", false);
SECOND_AUTH_MAX_ATTEMPTS = serverSettings.getProperty("SecondAuthMaxEnter", 5);
SECOND_AUTH_BAN_TIME = serverSettings.getProperty("SecondAuthBanTime", 480);
HIDE_GM_STATUS = serverSettings.getProperty("HideGMStatus", false);
SHOW_GM_LOGIN = serverSettings.getProperty("ShowGMLogin", true);
SAVE_GM_EFFECTS = serverSettings.getProperty("SaveGMEffects", false);
CNAME_TEMPLATE = serverSettings.getProperty("CnameTemplate", "[A-Za-z0-9\u0410-\u042f\u0430-\u044f]{2,16}");
CLAN_NAME_TEMPLATE = serverSettings.getProperty("ClanNameTemplate", "[A-Za-z0-9\u0410-\u042f\u0430-\u044f]{3,16}");
CLAN_TITLE_TEMPLATE = serverSettings.getProperty("ClanTitleTemplate", "[A-Za-z0-9\u0410-\u042f\u0430-\u044f \\p{Punct}]{1,16}");
ALLY_NAME_TEMPLATE = serverSettings.getProperty("AllyNameTemplate", "[A-Za-z0-9\u0410-\u042f\u0430-\u044f]{3,16}");
GLOBAL_SHOUT = serverSettings.getProperty("GlobalShout", false);
GLOBAL_TRADE_CHAT = serverSettings.getProperty("GlobalTradeChat", false);
CHAT_RANGE = serverSettings.getProperty("ChatRange", 1250);
SHOUT_OFFSET = serverSettings.getProperty("ShoutOffset", 0);
PREMIUM_HEROCHAT = serverSettings.getProperty("PremiumHeroChat", true);
LOG_CHAT = serverSettings.getProperty("LogChat", false);
RATE_XP = serverSettings.getProperty("RateXp", 1.);
RATE_SP = serverSettings.getProperty("RateSp", 1.);
RATE_QUESTS_REWARD = serverSettings.getProperty("RateQuestsReward", 1.);
RATE_QUESTS_DROP = serverSettings.getProperty("RateQuestsDrop", 1.);
RATE_CLAN_REP_SCORE = serverSettings.getProperty("RateClanRepScore", 1.);
RATE_CLAN_REP_SCORE_MAX_AFFECTED = serverSettings.getProperty("RateClanRepScoreMaxAffected", 2);
RATE_DROP_ADENA = serverSettings.getProperty("RateDropAdena", 1.);
RATE_DROP_ITEMS = serverSettings.getProperty("RateDropItems", 1.);
RATE_DROP_COMMON_ITEMS = serverSettings.getProperty("RateDropCommonItems", 1.);
RATE_DROP_RAIDBOSS = serverSettings.getProperty("RateRaidBoss", 1.);
RATE_DROP_SPOIL = serverSettings.getProperty("RateDropSpoil", 1.);
NO_RATE_ITEMS = serverSettings.getProperty("NoRateItemIds", new int[]
{
6660,
6662,
6661,
6659,
6656,
6658,
8191,
6657,
10170,
10314,
16025,
16026
});
NO_RATE_EQUIPMENT = serverSettings.getProperty("NoRateEquipment", true);
NO_RATE_KEY_MATERIAL = serverSettings.getProperty("NoRateKeyMaterial", true);
NO_RATE_RECIPES = serverSettings.getProperty("NoRateRecipes", true);
RATE_DROP_SIEGE_GUARD = serverSettings.getProperty("RateSiegeGuard", 1.);
RATE_MANOR = serverSettings.getProperty("RateManor", 1.);
RATE_FISH_DROP_COUNT = serverSettings.getProperty("RateFishDropCount", 1.);
RATE_PARTY_MIN = serverSettings.getProperty("RatePartyMin", false);
RATE_HELLBOUND_CONFIDENCE = serverSettings.getProperty("RateHellboundConfidence", 1.);
RATE_MOB_SPAWN = serverSettings.getProperty("RateMobSpawn", 1);
RATE_MOB_SPAWN_MIN_LEVEL = serverSettings.getProperty("RateMobMinLevel", 1);
RATE_MOB_SPAWN_MAX_LEVEL = serverSettings.getProperty("RateMobMaxLevel", 100);
RATE_RAID_REGEN = serverSettings.getProperty("RateRaidRegen", 1.);
RATE_RAID_DEFENSE = serverSettings.getProperty("RateRaidDefense", 1.);
RATE_RAID_ATTACK = serverSettings.getProperty("RateRaidAttack", 1.);
RATE_EPIC_DEFENSE = serverSettings.getProperty("RateEpicDefense", RATE_RAID_DEFENSE);
RATE_EPIC_ATTACK = serverSettings.getProperty("RateEpicAttack", RATE_RAID_ATTACK);
RAID_MAX_LEVEL_DIFF = serverSettings.getProperty("RaidMaxLevelDiff", 8);
PARALIZE_ON_RAID_DIFF = serverSettings.getProperty("ParalizeOnRaidLevelDiff", true);
AUTODESTROY_ITEM_AFTER = serverSettings.getProperty("AutoDestroyDroppedItemAfter", 0);
AUTODESTROY_PLAYER_ITEM_AFTER = serverSettings.getProperty("AutoDestroyPlayerDroppedItemAfter", 0);
DELETE_DAYS = serverSettings.getProperty("DeleteCharAfterDays", 7);
PURGE_BYPASS_TASK_FREQUENCY = serverSettings.getProperty("PurgeTaskFrequency", 60);
try
{
DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
}
catch (IOException e)
{
_log.error("", e);
}
ALLOW_DISCARDITEM = serverSettings.getProperty("AllowDiscardItem", true);
ALLOW_MAIL = serverSettings.getProperty("AllowMail", true);
ALLOW_WAREHOUSE = serverSettings.getProperty("AllowWarehouse", true);
ALLOW_WATER = serverSettings.getProperty("AllowWater", true);
ALLOW_CURSED_WEAPONS = serverSettings.getProperty("AllowCursedWeapons", false);
DROP_CURSED_WEAPONS_ON_KICK = serverSettings.getProperty("DropCursedWeaponsOnKick", false);
MIN_PROTOCOL_REVISION = serverSettings.getProperty("MinProtocolRevision", 415);
MAX_PROTOCOL_REVISION = serverSettings.getProperty("MaxProtocolRevision", 448);
MIN_NPC_ANIMATION = serverSettings.getProperty("MinNPCAnimation", 5);
MAX_NPC_ANIMATION = serverSettings.getProperty("MaxNPCAnimation", 90);
SERVER_SIDE_NPC_NAME = serverSettings.getProperty("ServerSideNpcName", false);
SERVER_SIDE_NPC_TITLE = serverSettings.getProperty("ServerSideNpcTitle", false);
AUTOSAVE = serverSettings.getProperty("Autosave", true);
MAXIMUM_ONLINE_USERS = serverSettings.getProperty("MaximumOnlineUsers", 3000);
DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
DATABASE_MAX_CONNECTIONS = serverSettings.getProperty("MaximumDbConnections", 10);
DATABASE_MAX_IDLE_TIMEOUT = serverSettings.getProperty("MaxIdleConnectionTimeout", 600);
DATABASE_IDLE_TEST_PERIOD = serverSettings.getProperty("IdleConnectionTestPeriod", 60);
DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2sdb");
DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
EFFECT_TASK_MANAGER_COUNT = serverSettings.getProperty("EffectTaskManagers", 2);
SCHEDULED_THREAD_POOL_SIZE = serverSettings.getProperty("ScheduledThreadPoolSize", NCPUS * 4);
EXECUTOR_THREAD_POOL_SIZE = serverSettings.getProperty("ExecutorThreadPoolSize", NCPUS * 2);
THREAD_P_MOVE = serverSettings.getProperty("ThreadPoolSizeMove", 25);
THREAD_P_PATHFIND = serverSettings.getProperty("ThreadPoolSizePathfind", 10);
NPC_AI_MAX_THREAD = serverSettings.getProperty("NpcAiMaxThread", 10);
PLAYER_AI_MAX_THREAD = serverSettings.getProperty("PlayerAiMaxThread", 20);
ENABLE_RUNNABLE_STATS = serverSettings.getProperty("EnableRunnableStats", false);
SELECTOR_CONFIG.SLEEP_TIME = serverSettings.getProperty("SelectorSleepTime", 10L);
SELECTOR_CONFIG.INTEREST_DELAY = serverSettings.getProperty("InterestDelay", 30L);
SELECTOR_CONFIG.MAX_SEND_PER_PASS = serverSettings.getProperty("MaxSendPerPass", 32);
SELECTOR_CONFIG.READ_BUFFER_SIZE = serverSettings.getProperty("ReadBufferSize", 65536);
SELECTOR_CONFIG.WRITE_BUFFER_SIZE = serverSettings.getProperty("WriteBufferSize", 131072);
SELECTOR_CONFIG.HELPER_BUFFER_COUNT = serverSettings.getProperty("BufferPoolSize", 64);
CHAT_MESSAGE_MAX_LEN = serverSettings.getProperty("ChatMessageLimit", 1000);
ABUSEWORD_BANCHAT = serverSettings.getProperty("ABUSEWORD_BANCHAT", false);
int counter = 0;
for (int id : serverSettings.getProperty("ABUSEWORD_BAN_CHANNEL", new int[]
{
0
}))
{
BAN_CHANNEL_LIST[counter] = id;
counter++;
}
ABUSEWORD_REPLACE = serverSettings.getProperty("ABUSEWORD_REPLACE", false);
ABUSEWORD_REPLACE_STRING = serverSettings.getProperty("ABUSEWORD_REPLACE_STRING", "[censored]");
BANCHAT_ANNOUNCE = serverSettings.getProperty("BANCHAT_ANNOUNCE", true);
BANCHAT_ANNOUNCE_FOR_ALL_WORLD = serverSettings.getProperty("BANCHAT_ANNOUNCE_FOR_ALL_WORLD", true);
BANCHAT_ANNOUNCE_NICK = serverSettings.getProperty("BANCHAT_ANNOUNCE_NICK", true);
ABUSEWORD_BANTIME = serverSettings.getProperty("ABUSEWORD_UNBAN_TIMER", 30);
CHATFILTER_MIN_LEVEL = serverSettings.getProperty("ChatFilterMinLevel", 0);
counter = 0;
for (int id : serverSettings.getProperty("ChatFilterChannels", new int[]
{
1,
8
}))
{
CHATFILTER_CHANNELS[counter] = id;
counter++;
}
CHATFILTER_WORK_TYPE = serverSettings.getProperty("ChatFilterWorkType", 1);
DEFAULT_LANG = serverSettings.getProperty("DefaultLang", "ru");
RESTART_AT_TIME = serverSettings.getProperty("AutoRestartAt", "0 5 * * *");
SHIFT_BY = serverSettings.getProperty("HShift", 12);
SHIFT_BY_Z = serverSettings.getProperty("VShift", 11);
MAP_MIN_Z = serverSettings.getProperty("MapMinZ", -32768);
MAP_MAX_Z = serverSettings.getProperty("MapMaxZ", 32767);
MOVE_PACKET_DELAY = serverSettings.getProperty("MovePacketDelay", 100);
ATTACK_PACKET_DELAY = serverSettings.getProperty("AttackPacketDelay", 500);
DAMAGE_FROM_FALLING = serverSettings.getProperty("DamageFromFalling", true);
ALLOW_WEDDING = serverSettings.getProperty("AllowWedding", false);
WEDDING_PRICE = serverSettings.getProperty("WeddingPrice", 500000);
WEDDING_PUNISH_INFIDELITY = serverSettings.getProperty("WeddingPunishInfidelity", true);
WEDDING_TELEPORT = serverSettings.getProperty("WeddingTeleport", true);
WEDDING_TELEPORT_PRICE = serverSettings.getProperty("WeddingTeleportPrice", 500000);
WEDDING_TELEPORT_INTERVAL = serverSettings.getProperty("WeddingTeleportInterval", 120);
WEDDING_SAMESEX = serverSettings.getProperty("WeddingAllowSameSex", true);
WEDDING_FORMALWEAR = serverSettings.getProperty("WeddingFormalWear", true);
WEDDING_DIVORCE_COSTS = serverSettings.getProperty("WeddingDivorceCosts", 20);
DONTLOADSPAWN = serverSettings.getProperty("StartWithoutSpawn", false);
DONTLOADQUEST = serverSettings.getProperty("StartWithoutQuest", false);
MAX_REFLECTIONS_COUNT = serverSettings.getProperty("MaxReflectionsCount", 300);
WEAR_DELAY = serverSettings.getProperty("WearDelay", 5);
GARBAGE_COLLECTOR_INTERVAL = serverSettings.getProperty("GarbageCollectorInterval", 30) * 60000;
HTM_CACHE_MODE = serverSettings.getProperty("HtmCacheMode", HtmCache.LAZY);
SERVER_SIDE_NPC_TITLE_ETC = serverSettings.getProperty("ServerSideNpcTitleEtc", false);
ALLOW_PACKET_FAIL = serverSettings.getProperty("AllowPacketFail", false);
Random ppc = new Random();
int z = ppc.nextInt(6);
if (z == 0)
{
z += 2;
}
for (int x = 0; x < 8; x++)
{
if (x == 4)
{
RWHO_ARRAY[x] = 44;
}
else
{
RWHO_ARRAY[x] = 51 + ppc.nextInt(z);
}
}
RWHO_ARRAY[11] = 37265 + ppc.nextInt((z * 2) + 3);
RWHO_ARRAY[8] = 51 + ppc.nextInt(z);
z = 36224 + ppc.nextInt(z * 2);
RWHO_ARRAY[9] = z;
RWHO_ARRAY[10] = z;
RWHO_ARRAY[12] = 1;
RWHO_LOG = Boolean.parseBoolean(serverSettings.getProperty("RemoteWhoLog", "False"));
RWHO_SEND_TRASH = Boolean.parseBoolean(serverSettings.getProperty("RemoteWhoSendTrash", "False"));
RWHO_MAX_ONLINE = Integer.parseInt(serverSettings.getProperty("RemoteWhoMaxOnline", "0"));
RWHO_KEEP_STAT = Integer.parseInt(serverSettings.getProperty("RemoteOnlineKeepStat", "5"));
RWHO_ONLINE_INCREMENT = Integer.parseInt(serverSettings.getProperty("RemoteOnlineIncrement", "0"));
RWHO_PRIV_STORE_FACTOR = Float.parseFloat(serverSettings.getProperty("RemotePrivStoreFactor", "0"));
RWHO_FORCE_INC = Integer.parseInt(serverSettings.getProperty("RemoteWhoForceInc", "0"));
}