Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/core/java/config/Olympiad.properties b/core/java/config/Olympiad.properties
- index 5c25403..9918cc6 100644
- --- a/core/java/config/Olympiad.properties
- +++ b/core/java/config/Olympiad.properties
- @@ -85,4 +85,11 @@
- # Enchant limit for items during Olympiad games. Disabled = -1.
- # Default: -1
- -AltOlyEnchantLimit = -1
- \ No newline at end of file
- +AltOlyEnchantLimit = -1
- +
- +#=====================================================
- +# Announce Time Olympiad in Enter World
- +#=====================================================
- +# Announce olympiad end on enter world.
- +# Default: False
- +AltOlyEndAnnounce = True
- \ No newline at end of file
- diff --git a/core/java/net/sf/l2j/Config.java b/core/java/net/sf/l2j/Config.java
- index 88ec0a3..d757665 100644
- --- a/core/java/net/sf/l2j/Config.java
- +++ b/core/java/net/sf/l2j/Config.java
- @@ -400,6 +400,9 @@
- /** Enchant limit for player items in Grand Olympiad games */
- public static int ALT_OLY_ENCHANT_LIMIT;
- + /** Olympiad Announce End Time */
- + public static boolean ALT_OLY_END_ANNOUNCE;
- +
- /** Manor Refresh Starting time */
- public static int ALT_MANOR_REFRESH_TIME;
- @@ -1952,6 +1955,7 @@
- ALT_OLY_LOSE_POINTS_ON_TIE = Boolean.valueOf(olympiadSettings.getProperty("AltOlyLosePointsOnTie", "true"));
- ALT_OLY_SHOW_MONTHLY_WINNERS = Boolean.valueOf(olympiadSettings.getProperty("AltOlyShowMonthlyWinners", "true"));
- ALT_OLY_ENCHANT_LIMIT = Integer.parseInt(olympiadSettings.getProperty("AltOlyEnchantLimit", "-1"));
- + ALT_OLY_END_ANNOUNCE = Boolean.parseBoolean(olympiadSettings.getProperty("AltOlyEndAnnounce", "False"));
- // Custom settings
- Properties customSettings = new Properties();
- diff --git a/core/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java b/core/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- index 7daf15e..0201a6a 100644
- --- a/core/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- +++ b/core/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- @@ -38,6 +38,8 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.Hero;
- import net.sf.l2j.gameserver.model.zone.type.L2OlympiadStadiumZone;
- +import net.sf.l2j.gameserver.network.clientpackets.Say2;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMatchEnd;
- import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
- import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadUserInfo;
- @@ -114,9 +116,9 @@
- // Default values
- protected int _currentCycle = 1;
- - protected int _period = 0;
- - protected long _olympiadEnd = 0;
- - protected long _validationEnd = 0;
- + protected static int _period = 0;
- + protected static long _olympiadEnd = 0;
- + protected static long _validationEnd = 0;
- protected long _nextWeeklyChange = 0;
- private long _compEnd;
- @@ -686,7 +688,7 @@
- }, getMillisToCompBegin());
- }
- - private long getMillisToOlympiadEnd()
- + private static long getMillisToOlympiadEnd()
- {
- return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
- }
- @@ -699,7 +701,7 @@
- _scheduledOlympiadEnd = ThreadPoolManager.getInstance().scheduleGeneral(new OlympiadEndTask(), 0);
- }
- - protected long getMillisToValidationEnd()
- + protected static long getMillisToValidationEnd()
- {
- if (_validationEnd > Calendar.getInstance().getTimeInMillis())
- return (_validationEnd - Calendar.getInstance().getTimeInMillis());
- @@ -861,7 +863,28 @@
- {
- return ZoneManager.getInstance().getOlympiadStadium(player) != null;
- }
- + public static void olympiadEnd(L2PcInstance player)
- + {
- + long milliToEnd;
- + if(_period == 0)
- + {
- + milliToEnd = getMillisToOlympiadEnd();
- + }
- + else
- + {
- + milliToEnd = getMillisToValidationEnd();
- + }
- + double numSecs = milliToEnd / 1000 % 60;
- + double countDown = (milliToEnd / 1000 - numSecs) / 60;
- + int numMins = (int) Math.floor(countDown % 60);
- + countDown = (countDown - numMins) / 60;
- + int numHours = (int) Math.floor(countDown % 24);
- + int numDays = (int) Math.floor((countDown - numHours) / 24);
- +
- + CreatureSay cs = new CreatureSay(0, Say2.ANNOUNCEMENT, "", "Olympiad period ends in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
- + player.sendPacket(cs);
- + }
- public int[] getWaitingList()
- {
- int[] array = new int[2];
- diff --git a/core/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/core/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- index 4e171f1..8036258 100644
- --- a/core/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- +++ b/core/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- @@ -151,7 +151,10 @@
- {
- activeChar.setIsDead(true);
- }
- -
- + if (Config.ALT_OLY_END_ANNOUNCE)
- + {
- + Olympiad.olympiadEnd(activeChar);
- + }
- L2Clan clan = activeChar.getClan();
- if (clan != null)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement