diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/TimeLimitedZones.ini b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/TimeLimitedZones.ini index 1777343e17..5b54b0c9f7 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/TimeLimitedZones.ini +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/TimeLimitedZones.ini @@ -6,6 +6,10 @@ # Default: 3600000 (1 hour) InitialTime = 3600000 +# Maximum added time. +# Default: 18000000 (5 hours) +MaximumAddedTime = 18000000 + # Reset delay. # Default: 36000000 (10 hours) ResetDelay = 36000000 diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java index 6e7aee1338..274699d44b 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java @@ -56,15 +56,22 @@ public class AddHuntingTime extends AbstractEffect } final long currentTime = System.currentTimeMillis(); + long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); + if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME)) + { + player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, false); + player.sendMessage("You cannot exceed the time zone limit."); + return; + } + if (player.isInTimedHuntingZone(_zoneId)) { - final long increasedTime = _time + player.getTimedHuntingZoneRemainingTime(); - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + increasedTime); - player.startTimedHuntingZone(_zoneId, increasedTime); + endTime = _time + player.getTimedHuntingZoneRemainingTime(); + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + endTime); + player.startTimedHuntingZone(_zoneId, endTime); } else { - long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime) { endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java index 6d4311d749..7043574b04 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -817,6 +817,7 @@ public class Config public static List TELNET_HOSTS; public static int TELNET_PORT; public static long TIME_LIMITED_ZONE_INITIAL_TIME; + public static long TIME_LIMITED_MAX_ADDED_TIME; public static long TIME_LIMITED_ZONE_RESET_DELAY; public static long TIME_LIMITED_ZONE_TELEPORT_FEE; public static boolean TRAINING_CAMP_ENABLE; @@ -1980,6 +1981,7 @@ public class Config final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE); TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000); + TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000); TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000); TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 150000); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index c1230a0dd2..6b1ff9e050 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -62,7 +62,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME; } packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time - packet.writeD(18000); // TODO: remain time max + packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000)); packet.writeD(3600); // remain refill time packet.writeD(3600); // refill time max packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated @@ -82,7 +82,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME; } packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time - packet.writeD(18000); // TODO: remain time max + packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000)); packet.writeD(3600); // remain refill time packet.writeD(3600); // refill time max packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/TimeLimitedZones.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/TimeLimitedZones.ini index 7de775c75f..2f4bda576d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/TimeLimitedZones.ini +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/TimeLimitedZones.ini @@ -6,6 +6,10 @@ # Default: 3600000 (1 hour) InitialTime = 3600000 +# Maximum added time. +# Default: 18000000 (5 hours) +MaximumAddedTime = 18000000 + # Reset delay. # Default: 36000000 (10 hours) ResetDelay = 36000000 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java index 6e7aee1338..274699d44b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/AddHuntingTime.java @@ -56,15 +56,22 @@ public class AddHuntingTime extends AbstractEffect } final long currentTime = System.currentTimeMillis(); + long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); + if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME)) + { + player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, false); + player.sendMessage("You cannot exceed the time zone limit."); + return; + } + if (player.isInTimedHuntingZone(_zoneId)) { - final long increasedTime = _time + player.getTimedHuntingZoneRemainingTime(); - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + increasedTime); - player.startTimedHuntingZone(_zoneId, increasedTime); + endTime = _time + player.getTimedHuntingZoneRemainingTime(); + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + endTime); + player.startTimedHuntingZone(_zoneId, endTime); } else { - long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0); if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime) { endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index 2e060a1cdd..d7c9fac22f 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -811,6 +811,7 @@ public class Config public static List TELNET_HOSTS; public static int TELNET_PORT; public static long TIME_LIMITED_ZONE_INITIAL_TIME; + public static long TIME_LIMITED_MAX_ADDED_TIME; public static long TIME_LIMITED_ZONE_RESET_DELAY; public static long TIME_LIMITED_ZONE_TELEPORT_FEE; public static boolean TRAINING_CAMP_ENABLE; @@ -1861,6 +1862,7 @@ public class Config final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE); TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000); + TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000); TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000); TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index b5d6ee197a..c50cdecfa5 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -62,7 +62,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME; } packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time - packet.writeD(18000); // TODO: remain time max + packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000)); packet.writeD(3600); // remain refill time packet.writeD(3600); // refill time max packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated