diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/Olympiad.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/Olympiad.ini index 7adeef58e8..9ef32dc842 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/Olympiad.ini @@ -173,12 +173,12 @@ AltOlyMaxWeeklyMatchesTeam = 10 # Enable/disable custom period settings. # Default: False AltOlyUseCustomPeriodSettings = False - + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +186,7 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/Config.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/Config.java index 4b4883df5a..15d590ff1f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/Config.java @@ -539,6 +539,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2280,6 +2281,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/Olympiad.ini b/L2J_Mobius_2.5_Underground/dist/game/config/Olympiad.ini index 3f6f4bdde8..355b5092a3 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_2.5_Underground/dist/game/config/Olympiad.ini @@ -173,12 +173,12 @@ AltOlyMaxWeeklyMatchesTeam = 10 # Enable/disable custom period settings. # Default: False AltOlyUseCustomPeriodSettings = False - + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +186,7 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java index cb9d6c83a8..3b877e6b65 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java @@ -546,6 +546,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2296,6 +2297,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/Olympiad.ini b/L2J_Mobius_3.0_Helios/dist/game/config/Olympiad.ini index 3f6f4bdde8..355b5092a3 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_3.0_Helios/dist/game/config/Olympiad.ini @@ -173,12 +173,12 @@ AltOlyMaxWeeklyMatchesTeam = 10 # Enable/disable custom period settings. # Default: False AltOlyUseCustomPeriodSettings = False - + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +186,7 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java index fdfbdb3f3a..6122e5c46e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java @@ -546,6 +546,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2305,6 +2306,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Olympiad.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Olympiad.ini index 3f6f4bdde8..355b5092a3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Olympiad.ini @@ -173,12 +173,12 @@ AltOlyMaxWeeklyMatchesTeam = 10 # Enable/disable custom period settings. # Default: False AltOlyUseCustomPeriodSettings = False - + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +186,7 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java index 1fa14a93d9..a9f7cd7f33 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java @@ -546,6 +546,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2303,6 +2304,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/main/olympiad.ini b/L2J_Mobius_C6_Interlude/dist/game/config/main/olympiad.ini index b451eea944..21b67beec2 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/main/olympiad.ini +++ b/L2J_Mobius_C6_Interlude/dist/game/config/main/olympiad.ini @@ -99,4 +99,8 @@ AltOlyTeleportCountDown = 120 # es. 2weeks-->AltOlyPeriod = WEEK and AltOlyPeriodMultiplier = 2 AltOlyUseCustomPeriodSettings = False AltOlyPeriod = MONTH -AltOlyPeriodMultiplier = 1 \ No newline at end of file +AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/Config.java index f59164aa55..381fc17640 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/Config.java @@ -947,6 +947,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static OlympiadPeriod ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static Map NORMAL_WEAPON_ENCHANT_LEVEL = new HashMap<>(); public static Map BLESS_WEAPON_ENCHANT_LEVEL = new HashMap<>(); @@ -2858,6 +2859,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Boolean.parseBoolean(OLYMPSetting.getProperty("AltOlyUseCustomPeriodSettings", "false")); ALT_OLY_PERIOD = OlympiadPeriod.valueOf(OLYMPSetting.getProperty("AltOlyPeriod", "MONTH")); ALT_OLY_PERIOD_MULTIPLIER = Integer.parseInt(OLYMPSetting.getProperty("AltOlyPeriodMultiplier", "1")); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : OLYMPSetting.getProperty("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } } catch (Exception e) { diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java index 518d669d82..f0365deb56 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java @@ -363,6 +363,36 @@ public class Olympiad _classBasedRegisters = new HashMap<>(); _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -907,6 +937,36 @@ public class Olympiad private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Olympiad.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Olympiad.ini index 8308a3e28f..b84494ce75 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Olympiad.ini @@ -177,12 +177,12 @@ AltOlyMaxWeeklyMatchesTeam = 10 # Enable/disable custom period settings. # Default: False AltOlyUseCustomPeriodSettings = False - + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -190,3 +190,7 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +AltOlyCompetitionDays = 1,2,3,4,5,6,7 diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/Config.java index ff1eb302f4..e83275cb61 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/Config.java @@ -583,6 +583,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2832,6 +2833,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index ef3fcc5d51..c80fc596ef 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -381,6 +381,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -681,6 +711,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Olympiad.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Olympiad.ini index 3f6f4bdde8..71cd5f6c4b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Olympiad.ini @@ -11,7 +11,8 @@ # Olympiad Start Time in Military hours Default 6pm (18) # Default: 18 -AltOlyStartTime = 18 +# Classic: 20 +AltOlyStartTime = 20 # Olympiad Start Time for Min's, Default 00 so at the start of the hour. # Default: 00 @@ -20,7 +21,8 @@ AltOlyMin = 00 # Olympiad Competition Period, Default 6 hours. # (If set different, should be increment by 10mins) # Default: 21600000 -AltOlyCPeriod = 21600000 +# Classic: 14400000 +AltOlyCPeriod = 14400000 # Olympiad Battle Period, Default 5 minutes. # Default: 300000 @@ -172,13 +174,14 @@ AltOlyMaxWeeklyMatchesTeam = 10 # --------------------------------------------------------------------------- # Enable/disable custom period settings. # Default: False -AltOlyUseCustomPeriodSettings = False - +# Classic: True +AltOlyUseCustomPeriodSettings = True + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +189,8 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +# Classic: 6,7 +AltOlyCompetitionDays = 6,7 diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java index d77369a35f..a818167263 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java @@ -545,6 +545,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2227,6 +2228,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24); diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Olympiad.ini b/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Olympiad.ini index 3f6f4bdde8..71cd5f6c4b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Olympiad.ini +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Olympiad.ini @@ -11,7 +11,8 @@ # Olympiad Start Time in Military hours Default 6pm (18) # Default: 18 -AltOlyStartTime = 18 +# Classic: 20 +AltOlyStartTime = 20 # Olympiad Start Time for Min's, Default 00 so at the start of the hour. # Default: 00 @@ -20,7 +21,8 @@ AltOlyMin = 00 # Olympiad Competition Period, Default 6 hours. # (If set different, should be increment by 10mins) # Default: 21600000 -AltOlyCPeriod = 21600000 +# Classic: 14400000 +AltOlyCPeriod = 14400000 # Olympiad Battle Period, Default 5 minutes. # Default: 300000 @@ -172,13 +174,14 @@ AltOlyMaxWeeklyMatchesTeam = 10 # --------------------------------------------------------------------------- # Enable/disable custom period settings. # Default: False -AltOlyUseCustomPeriodSettings = False - +# Classic: True +AltOlyUseCustomPeriodSettings = True + # Change the type of delay between two Olympiads. # Available values: MONTH, WEEK, DAY # Default: MONTH AltOlyPeriodType = MONTH - + # Change the Olympiad frequency. # The value is a multiplier of period type, # i.e. if type is MONTH and multiplier is 2, @@ -186,3 +189,8 @@ AltOlyPeriodType = MONTH # Default: 1 # Note! If type = DAY, multiplier must be >= 7! AltOlyPeriodMultiplier = 1 + +# Enable competitions only on specific days. +# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY) +# Classic: 6,7 +AltOlyCompetitionDays = 6,7 diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/Config.java index bcec7f7a12..ef1ac2d4d5 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/Config.java @@ -545,6 +545,7 @@ public final class Config public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; public static String ALT_OLY_PERIOD; public static int ALT_OLY_PERIOD_MULTIPLIER; + public static List ALT_OLY_COMPETITION_DAYS; public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; public static int ALT_MANOR_APPROVE_TIME; @@ -2231,6 +2232,11 @@ public final class Config ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); + ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); + for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(",")) + { + ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s)); + } final File hexIdFile = new File(HEXID_FILE); if (hexIdFile.exists()) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java index 2087510b72..724b7229fc 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer } _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; @@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) + { + final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + boolean dayFound = false; + int dayCounter = 0; + for (int i = currentDay; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + dayFound = true; + break; + } + dayCounter++; + } + if (!dayFound) + { + for (int i = 1; i < 8; i++) + { + if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) + { + break; + } + dayCounter++; + } + } + if (dayCounter > 0) + { + _compStart.add(Calendar.DAY_OF_MONTH, dayCounter); + } + } _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); _compStart.set(Calendar.MINUTE, COMP_MIN); _compStart.add(Calendar.HOUR_OF_DAY, 24);