Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/aCis_gameserver/config/events.properties b/aCis_gameserver/config/events.properties
- index 3f19588..b305edc 100644
- --- a/aCis_gameserver/config/events.properties
- +++ b/aCis_gameserver/config/events.properties
- @@ -93,7 +93,9 @@
- AltOlyPeriod = WEEK
- AltOlyPeriodMultiplier = 2
- +# Announce olympiad end on enter world.
- +# Default: False
- +AltOlyEndAnnounce = True
- #=============================================================
- # Seven Signs && Festival
- diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
- index 61fdf2b..6e01ee8 100644
- --- a/aCis_gameserver/java/net/sf/l2j/Config.java
- +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
- @@ -150,7 +150,8 @@
- /** Olly Period */
- public static OlympiadPeriod ALT_OLY_PERIOD;
- public static int ALT_OLY_PERIOD_MULTIPLIER;
- + public static boolean ALT_OLY_END_ANNOUNCE;
- +
- /** SevenSigns Festival */
- public static boolean SEVEN_SIGNS_BYPASS_PREREQUISITES;
- public static int FESTIVAL_MIN_PLAYER;
- @@ -769,6 +770,7 @@
- ALT_OLY_PERIOD = OlympiadPeriod.valueOf(events.getProperty("AltOlyPeriod", "MONTH"));
- ALT_OLY_PERIOD_MULTIPLIER = events.getProperty("AltOlyPeriodMultiplier", 1);
- + ALT_OLY_END_ANNOUNCE = Boolean.parseBoolean(events.getProperty("AltOlyEndAnnounce", "False"));
- SEVEN_SIGNS_BYPASS_PREREQUISITES = events.getProperty("SevenSignsBypassPrerequisites", false);
- FESTIVAL_MIN_PLAYER = MathUtil.limit(events.getProperty("FestivalMinPlayer", 5), 2, 9);
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- index c198961..75fcdb2 100644
- --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- @@ -20,7 +20,6 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.HeroManager;
- import net.sf.l2j.gameserver.data.manager.ZoneManager;
- -import net.sf.l2j.gameserver.enums.OlympiadState;
- import net.sf.l2j.gameserver.enums.OlympiadType;
- import net.sf.l2j.gameserver.enums.SayType;
- import net.sf.l2j.gameserver.model.World;
- @@ -28,6 +27,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc;
- import net.sf.l2j.gameserver.model.zone.type.OlympiadStadiumZone;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- @@ -63,10 +63,10 @@
- public static final String COMP_LOST = "competitions_lost";
- public static final String COMP_DRAWN = "competitions_drawn";
- - protected long _olympiadEnd;
- - protected long _validationEnd;
- -
- - protected OlympiadState _period;
- + protected static long _olympiadEnd;
- + protected static long _validationEnd;
- +
- + protected static int _period;
- protected long _nextWeeklyChange;
- protected int _currentCycle;
- private long _compEnd;
- @@ -85,7 +85,7 @@
- {
- load();
- - if (_period == OlympiadState.COMPETITION)
- + if (_period == 0)
- init();
- }
- @@ -110,9 +110,32 @@
- return (set == null) ? 0 : set.getInteger(POINTS);
- }
- + public static void olympiadEnd(Player 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, SayType.PARTY, "", "Olympiad period ends in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
- + player.sendPacket(cs);
- + }
- +
- public boolean isOlympiadEnd()
- {
- - return _period == OlympiadState.VALIDATION;
- + return _period == 0;
- }
- public boolean isInCompPeriod()
- @@ -134,7 +157,8 @@
- if (rs.next())
- {
- _currentCycle = rs.getInt("current_cycle");
- - _period = Enum.valueOf(OlympiadState.class, rs.getString("period"));
- + //_period = Enum.valueOf(OlympiadState.class, rs.getString("period"));
- + _period = rs.getInt("period");
- _olympiadEnd = rs.getLong("olympiad_end");
- _validationEnd = rs.getLong("validation_end");
- _nextWeeklyChange = rs.getLong("next_weekly_change");
- @@ -142,7 +166,7 @@
- else
- {
- _currentCycle = 1;
- - _period = OlympiadState.COMPETITION;
- + _period = 0;
- _olympiadEnd = 0;
- _validationEnd = 0;
- _nextWeeklyChange = 0;
- @@ -157,14 +181,14 @@
- switch (_period)
- {
- - case COMPETITION:
- + case 0:
- if (_olympiadEnd == 0 || _olympiadEnd < Calendar.getInstance().getTimeInMillis())
- setNewOlympiadEnd();
- else
- scheduleWeeklyChange();
- break;
- - case VALIDATION:
- + case 1:
- if (_validationEnd > Calendar.getInstance().getTimeInMillis())
- {
- // Process rank rewards.
- @@ -175,7 +199,7 @@
- else
- {
- _currentCycle++;
- - _period = OlympiadState.COMPETITION;
- + _period = 0;
- deleteNobles();
- setNewOlympiadEnd();
- @@ -209,14 +233,14 @@
- synchronized (this)
- {
- long milliToEnd;
- - if (_period == OlympiadState.COMPETITION)
- + if (_period == 0)
- milliToEnd = getMillisToOlympiadEnd();
- else
- milliToEnd = getMillisToValidationEnd();
- LOGGER.info("{} minutes until Olympiad period ends.", Math.round(milliToEnd / 60000));
- - if (_period == OlympiadState.COMPETITION)
- + if (_period == 0)
- {
- milliToEnd = getMillisToWeekChange();
- LOGGER.info("Next weekly Olympiad change is in {} minutes.", Math.round(milliToEnd / 60000));
- @@ -287,7 +311,7 @@
- private void init()
- {
- - if (_period == OlympiadState.VALIDATION)
- + if (_period == 0)
- return;
- _compStart = Calendar.getInstance();
- @@ -399,7 +423,7 @@
- }, getMillisToCompBegin());
- }
- - private long getMillisToOlympiadEnd()
- + private static long getMillisToOlympiadEnd()
- {
- return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
- }
- @@ -412,7 +436,7 @@
- _olympiadEndTask = ThreadPool.schedule(this::olympiadEnd, 0);
- }
- - private long getMillisToValidationEnd()
- + private static long getMillisToValidationEnd()
- {
- if (_validationEnd > Calendar.getInstance().getTimeInMillis())
- return (_validationEnd - Calendar.getInstance().getTimeInMillis());
- @@ -522,7 +546,7 @@
- {
- _nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + Config.OLY_WPERIOD;
- - if (_period == OlympiadState.VALIDATION)
- + if (_period == 0)
- return;
- for (StatSet set : _nobles.values())
- @@ -574,7 +598,7 @@
- /**
- * Save current olympiad status and update noblesse table in database
- */
- - public void saveOlympiadStatus()
- +/** public void saveOlympiadStatus()
- {
- saveNobleData();
- @@ -597,7 +621,35 @@
- {
- LOGGER.error("Couldn't save Olympiad status.", e);
- }
- + }*/
- +
- + public void saveOlympiadStatus()
- + {
- + saveNobleData();
- +
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement ps = con.prepareStatement(INSERT_OLYMPIAD_DATA))
- + {
- + ps.setInt(1, _currentCycle);
- + ps.setInt(2, _period);
- + ps.setLong(3, _olympiadEnd);
- + ps.setLong(4, _validationEnd);
- + ps.setLong(5, _nextWeeklyChange);
- + ps.setInt(6, _currentCycle);
- + ps.setInt(7, _period);
- + ps.setLong(8, _olympiadEnd);
- + ps.setLong(9, _validationEnd);
- + ps.setLong(10, _nextWeeklyChange);
- +
- + ps.execute();
- + ps.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.error("Couldn't save Olympiad status.", e);
- + }
- }
- +
- public List<String> getClassLeaderBoard(int classId)
- {
- @@ -624,7 +676,7 @@
- public int getNoblessePasses(Player player, boolean clear)
- {
- - if (player == null || _period != OlympiadState.VALIDATION)
- + if (player == null || _period != 0)
- return 0;
- final Integer rankReward = _rankRewards.get(player.getObjectId());
- @@ -707,7 +759,7 @@
- saveNobleData();
- - _period = OlympiadState.VALIDATION;
- + _period = 0;
- HeroManager.getInstance().resetData();
- HeroManager.getInstance().computeNewHeroes();
- @@ -737,7 +789,7 @@
- private void validationEnd()
- {
- - _period = OlympiadState.COMPETITION;
- + _period = 0;
- _currentCycle++;
- deleteNobles();
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- index 2a9b743..cdc54ea 100644
- --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- @@ -222,6 +222,8 @@
- player.sendPacket(SevenSignsManager.getInstance().getCurrentPeriod().getMessageId());
- AnnouncementData.getInstance().showAnnouncements(player, false);
- + if (Config.ALT_OLY_END_ANNOUNCE) { Olympiad.olympiadEnd(player); }
- +
- // If the Player is a Dark Elf, check for Shadow Sense at night.
- if (player.getRace() == ClassRace.DARK_ELF && player.hasSkill(L2Skill.SKILL_SHADOW_SENSE))
- player.sendPacket(SystemMessage.getSystemMessage((GameTimeTaskManager.getInstance().isNight()) ? SystemMessageId.NIGHT_S1_EFFECT_APPLIES : SystemMessageId.DAY_S1_EFFECT_DISAPPEARS).addSkillName(L2Skill.SKILL_SHADOW_SENSE));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement