Olympiad Set days

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
puchuperro
Posts: 7
Joined: Wed Sep 28, 2016 10:19 am

Olympiad Set days

Post by puchuperro »

Hi every one i use marter branch
i will like to set olympiad only friday and saturday and give hero every week
is that posible ??

sorry i am new , but leaning , ty all
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: Olympiad Set days

Post by JMD »

puchuperro wrote: Wed Jun 28, 2017 12:27 pm Hi every one i use marter branch
i will like to set olympiad only friday and saturday and give hero every week
is that posible ??

sorry i am new , but leaning , ty all
This should get you 50% of the way.
Gist by: JMD13
### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 6469)
+++ java/com/l2jserver/Config.java (working copy)
@@ -599,6 +599,9 @@
public static List<Integer> LIST_OLY_RESTRICTED_ITEMS;
public static int ALT_OLY_ENCHANT_LIMIT;
public static int ALT_OLY_WAIT_TIME;
+ public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS;
+ public static String ALT_OLY_PERIOD;
+ public static int ALT_OLY_PERIOD_MULTIPLIER;
public static int ALT_MANOR_REFRESH_TIME;
public static int ALT_MANOR_REFRESH_MIN;
public static int ALT_MANOR_APPROVE_TIME;
@@ -2683,6 +2686,9 @@
}
ALT_OLY_ENCHANT_LIMIT = Olympiad.getInt("AltOlyEnchantLimit", -1);
ALT_OLY_WAIT_TIME = Olympiad.getInt("AltOlyWaitTime", 120);
+ 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);
final File hexIdFile = new File(HEXID_FILE);
if (hexIdFile.exists())
Index: java/com/l2jserver/gameserver/model/olympiad/Olympiad.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (revision 6469)
+++ java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (working copy)
@@ -584,6 +584,12 @@
protected void setNewOlympiadEnd()
{
+ if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS)
+ {
+ setNewOlympiadEndCustom();
+ return;
+ }
+
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.OLYMPIAD_PERIOD_S1_HAS_STARTED);
sm.addInt(_currentCycle);
@@ -603,6 +609,70 @@
scheduleWeeklyChange();
}
+ protected void setNewOlympiadEndCustom()
+ {
+ SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.OLYMPIAD_PERIOD_S1_HAS_STARTED);
+ sm.addInt(_currentCycle);
+
+ Announcements.getInstance().announceToAll(sm);
+
+ Calendar currentTime = Calendar.getInstance();
+ currentTime.set(Calendar.AM_PM, Calendar.AM);
+ currentTime.set(Calendar.HOUR, 12);
+ currentTime.set(Calendar.MINUTE, 0);
+ currentTime.set(Calendar.SECOND, 0);
+
+ Calendar nextChange = Calendar.getInstance();
+
+ switch (Config.ALT_OLY_PERIOD)
+ {
+ case "DAY":
+ {
+ currentTime.add(Calendar.DAY_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
+ currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
+
+ if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 14)
+ {
+ _nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
+ }
+ else if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 7)
+ {
+ _nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2);
+ }
+ else
+ {
+ _log.warning("Invalid config value for Config.ALT_OLY_PERIOD_MULTIPLIER, must be >= 7");
+ }
+ break;
+ }
+ case "WEEK":
+ {
+ currentTime.add(Calendar.WEEK_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
+ currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
+
+ if (Config.ALT_OLY_PERIOD_MULTIPLIER > 1)
+ {
+ _nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
+ }
+ else
+ {
+ _nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2);
+ }
+ break;
+ }
+ case "MONTH":
+ {
+ currentTime.add(Calendar.MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
+ currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
+
+ _nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
+ break;
+ }
+ }
+ _olympiadEnd = currentTime.getTimeInMillis();
+ scheduleWeeklyChange();
+ }
+
public boolean inCompPeriod()
{
return _inCompPeriod;
Index: dist/game/config/Olympiad.properties
===================================================================
--- dist/game/config/Olympiad.properties (revision 6469)
+++ dist/game/config/Olympiad.properties (working copy)
@@ -159,4 +159,30 @@
# Maximum number of Class-Irrelevant Team matches a character can join per week
# Default: 10
-AltOlyMaxWeeklyMatchesTeam = 10
\ No newline at end of file
+AltOlyMaxWeeklyMatchesTeam = 10
+
+
+# ---------------------------------------------------------------------------
+# Custom Olympiad period settings
+# ---------------------------------------------------------------------------
+# Example for Olympiad every 2 weeks:
+# AltOlyUseCustomPeriodSettings = True
+# AltOlyPeriod = WEEK
+# AltOlyPeriodMultiplier = 2
+# ---------------------------------------------------------------------------
+# 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,
+# then Olympiad will occur every 2 months.
+# Default: 1
+# Note! If type = DAY, multiplier must be >= 7!
+AltOlyPeriodMultiplier = 1
\ No newline at end of file
puchuperro
Posts: 7
Joined: Wed Sep 28, 2016 10:19 am

Re: Olympiad Set days

Post by puchuperro »

I tryed , but when i copile give me error

\git\l2j_server\src\main\java\com\l2jserver\gameserver\model\olympiad\Olympiad.java:610: error: cannot find symbol
Announcements.getInstance().announceToAll(sm);
^
symbol: variable Announcements
location: class Olympiad
> Building 5% > :compileJava

there is not somethig more simple???
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: Olympiad Set days

Post by JMD »

puchuperro wrote: Thu Jun 29, 2017 2:34 pm I tryed , but when i copile give me error

\git\l2j_server\src\main\java\com\l2jserver\gameserver\model\olympiad\Olympiad.java:610: error: cannot find symbol
Announcements.getInstance().announceToAll(sm);
^
symbol: variable Announcements
location: class Olympiad
> Building 5% > :compileJava

there is not somethig more simple???
there are no simple solutions with l2j, try adding the patch manually (copy - paste then remove the +)

or look where the Announcements.java has been moved and fix the import path.
puchuperro
Posts: 7
Joined: Wed Sep 28, 2016 10:19 am

Re: Olympiad Set days

Post by puchuperro »

Thx for all
No posible to add somethig like this???

Calendar now = Calendar.getInstance();
int day = now.get(Calendar.DAY_OF_WEEK);
if (day >= Calendar.MONDAY && day <= Calendar.FRIDAY)
// do something
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7008
Joined: Tue Aug 11, 2009 3:36 am

Re: Olympiad Set days

Post by Zoey76 »

I've requested a developer to check it and evaluate if we can add it to the source as a configurable setting.
Powered by Eclipse 4.34 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.3.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
puchuperro
Posts: 7
Joined: Wed Sep 28, 2016 10:19 am

Re: Olympiad Set days

Post by puchuperro »

Thx Zoey76 that will be helpfull for all noobs like me
puchuperro
Posts: 7
Joined: Wed Sep 28, 2016 10:19 am

Re: Olympiad Set days

Post by puchuperro »

puchuperro wrote: Thu Jul 20, 2017 10:35 am Thx Zoey76 that will be helpfull for all noobs like me
Any news ???
Post Reply