Addition of Time Limited Zones configurations.

This commit is contained in:
MobiusDevelopment
2020-01-23 16:32:46 +00:00
parent 6cd49da1fb
commit e44125f798
10 changed files with 82 additions and 24 deletions

View File

@@ -0,0 +1,15 @@
# ---------------------------------------------------------------------------
# Time Limited Zones
# ---------------------------------------------------------------------------
# Initial free time.
# Default: 3600000 (1 hour)
InitialTime = 3600000
# Reset delay.
# Default: 36000000 (10 hours)
ResetDelay = 36000000
# Teleport fee.
# Default: 150000
TeleportFee = 150000

View File

@@ -16,6 +16,7 @@
*/ */
package handlers.effecthandlers; package handlers.effecthandlers;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@@ -64,9 +65,9 @@ public class AddHuntingTime extends AbstractEffect
else else
{ {
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
else if (endTime < currentTime) else if (endTime < currentTime)
{ {

View File

@@ -105,6 +105,7 @@ public class Config
private static final String RATES_CONFIG_FILE = "./config/Rates.ini"; private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
private static final String SERVER_CONFIG_FILE = "./config/Server.ini"; private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini"; private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini"; private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt"; private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
private static final String HEXID_FILE = "./config/hexid.txt"; private static final String HEXID_FILE = "./config/hexid.txt";
@@ -815,6 +816,9 @@ public class Config
public static String TELNET_HOSTNAME; public static String TELNET_HOSTNAME;
public static List<String> TELNET_HOSTS; public static List<String> TELNET_HOSTS;
public static int TELNET_PORT; public static int TELNET_PORT;
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
public static long TIME_LIMITED_ZONE_RESET_DELAY;
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
public static boolean TRAINING_CAMP_ENABLE; public static boolean TRAINING_CAMP_ENABLE;
public static boolean TRAINING_CAMP_PREMIUM_ONLY; public static boolean TRAINING_CAMP_PREMIUM_ONLY;
public static int TRAINING_CAMP_MAX_DURATION; public static int TRAINING_CAMP_MAX_DURATION;
@@ -1972,6 +1976,13 @@ public class Config
TELNET_PASSWORD = telnetSettings.getString("Password", ""); TELNET_PASSWORD = telnetSettings.getString("Password", "");
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(",")); TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
// Load Time Limited Zone config file (if exists)
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 150000);
// Load Training Camp config file (if exists) // Load Training Camp config file (if exists)
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE); final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);

View File

@@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.sessionzones; package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
@@ -82,16 +83,16 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; // 300 minutes endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
if (endTime > currentTime) if (endTime > currentTime)
{ {
if (player.getAdena() > 150000) if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
{ {
player.reduceAdena("TimedHuntingZone", 150000, player, true); player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
} }
else else
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.serverpackets.sessionzones; package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.variables.PlayerVariables; import org.l2jmobius.gameserver.model.variables.PlayerVariables;
@@ -49,19 +50,19 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
// Storm Isle // Storm Isle
packet.writeD(1); // required item count packet.writeD(1); // required item count
packet.writeD(57); // item id packet.writeD(57); // item id
packet.writeQ(150000); // item count packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
packet.writeD(1); // reset cycle packet.writeD(1); // reset cycle
packet.writeD(1); // zone id packet.writeD(1); // zone id
packet.writeD(100); // min level packet.writeD(100); // min level
packet.writeD(120); // max level packet.writeD(120); // max level
packet.writeD(0); // remain time base? packet.writeD(0); // remain time base?
endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
packet.writeD(18000); // remain time max packet.writeD(18000); // TODO: remain time max
packet.writeD(3600); // remain refill time packet.writeD(3600); // remain refill time
packet.writeD(3600); // refill time max packet.writeD(3600); // refill time max
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
@@ -69,19 +70,19 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
// Primeval Isle // Primeval Isle
packet.writeD(1); // required item count packet.writeD(1); // required item count
packet.writeD(57); // item id packet.writeD(57); // item id
packet.writeQ(150000); // item count packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
packet.writeD(1); // reset cycle packet.writeD(1); // reset cycle
packet.writeD(6); // zone id packet.writeD(6); // zone id
packet.writeD(105); // min level packet.writeD(105); // min level
packet.writeD(120); // max level packet.writeD(120); // max level
packet.writeD(0); // remain time base? packet.writeD(0); // remain time base?
endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0); endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
packet.writeD(18000); // remain time max packet.writeD(18000); // TODO: remain time max
packet.writeD(3600); // remain refill time packet.writeD(3600); // remain refill time
packet.writeD(3600); // refill time max packet.writeD(3600); // refill time max
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated

View File

@@ -0,0 +1,15 @@
# ---------------------------------------------------------------------------
# Time Limited Zones
# ---------------------------------------------------------------------------
# Initial free time.
# Default: 3600000 (1 hour)
InitialTime = 3600000
# Reset delay.
# Default: 36000000 (10 hours)
ResetDelay = 36000000
# Teleport fee.
# Default: 10000
TeleportFee = 10000

View File

@@ -16,6 +16,7 @@
*/ */
package handlers.effecthandlers; package handlers.effecthandlers;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@@ -64,9 +65,9 @@ public class AddHuntingTime extends AbstractEffect
else else
{ {
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
else if (endTime < currentTime) else if (endTime < currentTime)
{ {

View File

@@ -104,6 +104,7 @@ public class Config
private static final String RATES_CONFIG_FILE = "./config/Rates.ini"; private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
private static final String SERVER_CONFIG_FILE = "./config/Server.ini"; private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini"; private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini"; private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt"; private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
private static final String HEXID_FILE = "./config/hexid.txt"; private static final String HEXID_FILE = "./config/hexid.txt";
@@ -809,6 +810,9 @@ public class Config
public static String TELNET_HOSTNAME; public static String TELNET_HOSTNAME;
public static List<String> TELNET_HOSTS; public static List<String> TELNET_HOSTS;
public static int TELNET_PORT; public static int TELNET_PORT;
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
public static long TIME_LIMITED_ZONE_RESET_DELAY;
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
public static boolean TRAINING_CAMP_ENABLE; public static boolean TRAINING_CAMP_ENABLE;
public static boolean TRAINING_CAMP_PREMIUM_ONLY; public static boolean TRAINING_CAMP_PREMIUM_ONLY;
public static int TRAINING_CAMP_MAX_DURATION; public static int TRAINING_CAMP_MAX_DURATION;
@@ -1853,6 +1857,13 @@ public class Config
TELNET_PASSWORD = telnetSettings.getString("Password", ""); TELNET_PASSWORD = telnetSettings.getString("Password", "");
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(",")); TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
// Load Time Limited Zone config file (if exists)
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000);
// Load Training Camp config file (if exists) // Load Training Camp config file (if exists)
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE); final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);

View File

@@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.sessionzones; package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
@@ -79,16 +80,16 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; // 300 minutes endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
if (endTime > currentTime) if (endTime > currentTime)
{ {
if (player.getAdena() > 10000) if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
{ {
player.reduceAdena("TimedHuntingZone", 10000, player, true); player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
} }
else else
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.serverpackets.sessionzones; package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.variables.PlayerVariables; import org.l2jmobius.gameserver.model.variables.PlayerVariables;
@@ -49,19 +50,19 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
// Ancient Pirates' Tomb // Ancient Pirates' Tomb
packet.writeD(1); // required item count packet.writeD(1); // required item count
packet.writeD(57); // item id packet.writeD(57); // item id
packet.writeQ(10000); // item count packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
packet.writeD(1); // reset cycle packet.writeD(1); // reset cycle
packet.writeD(2); // zone id packet.writeD(2); // zone id
packet.writeD(78); // min level packet.writeD(78); // min level
packet.writeD(999); // max level packet.writeD(999); // max level
packet.writeD(0); // remain time base? packet.writeD(0); // remain time base?
endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0); endTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0);
if ((endTime + 18000000) < currentTime) if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
{ {
endTime = currentTime + 18000000; endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
} }
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
packet.writeD(18000); // remain time max packet.writeD(18000); // TODO: remain time max
packet.writeD(3600); // remain refill time packet.writeD(3600); // remain refill time
packet.writeD(3600); // refill time max packet.writeD(3600); // refill time max
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated