tazerman2 Posted February 25, 2017 Posted February 25, 2017 - long milliToEnd; - if (_period == 0) - milliToEnd = getMillisToOlympiadEnd(); - else - milliToEnd = getMillisToValidationEnd(); - - LOGGER.info("Olympiad System: " + Math.round(milliToEnd / 60000) + " minutes until period ends"); - - if (_period == 0) - { - milliToEnd = getMillisToWeekChange(); - - LOGGER.info("Olympiad System: Next weekly change is in " + Math.round(milliToEnd / 60000) + " minutes"); - } + long milliToEnd; + if (_period == 0) + milliToEnd = getMillisToOlympiadEnd(); + else + milliToEnd = getMillisToValidationEnd(); + + double numSecs = (milliToEnd / 1000) % 60; + double countDown = ((milliToEnd / 1000) - numSecs) / 60; + final 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); + + LOGGER.info("Olympiad System: " + numDays + " days, " + numHours + " hours and " + numMins + " mins. until period ends"); + + if (_period == 0) + { + long milliToEnd2 = getMillisToWeekChange(); + + double numSecs1 = (milliToEnd2 / 1000) % 60; + double countDown1 = ((milliToEnd2 / 1000) - numSecs1) / 60; + final int numMins1 = (int) Math.floor(countDown1 % 60); + countDown1 = (countDown - numMins1) / 60; + int numHours1 = (int) Math.floor(countDown1 % 24); + int numDays1 = (int) Math.floor((countDown1 - numHours1) / 24); + + LOGGER.info("Olympiad System: Next weekly change in " + numDays1 + " days, " + numHours1 + " hours and " + numMins1 + " mins."); } 1 1 Quote
MarGaZeaS Posted February 27, 2017 Posted February 27, 2017 (edited) Thanks for share. please add prefix Code :) Edited February 27, 2017 by PaRaNoiC* Quote
Cocaine* Posted March 25, 2017 Posted March 25, 2017 Where i need put this? package com.l2jfrozen.gameserver.model.entity.olympiad; Quote
vecc Posted April 27, 2017 Posted April 27, 2017 (edited) Thank you for the share, but Explain me something, please! "6 days, 17 hours and 5 min until period ends" this means that weekly competition will end in this time, correct? So what does this mean? > Next weekly change in 0 days, 02 hour and 14 min. ??? Isnt the weekly change above already? :wacko: :wacko: Edited April 27, 2017 by vecc Quote
nortim Posted July 21, 2017 Posted July 21, 2017 - long milliToEnd; - if (_period == 0) - milliToEnd = getMillisToOlympiadEnd(); - else - milliToEnd = getMillisToValidationEnd(); - - LOGGER.info("Olympiad System: " + Math.round(milliToEnd / 60000) + " minutes until period ends"); - - if (_period == 0) - { - milliToEnd = getMillisToWeekChange(); - - LOGGER.info("Olympiad System: Next weekly change is in " + Math.round(milliToEnd / 60000) + " minutes"); - } + long milliToEnd; + if (_period == 0) + milliToEnd = getMillisToOlympiadEnd(); + else + milliToEnd = getMillisToValidationEnd(); + + double numSecs = (milliToEnd / 1000) % 60; + double countDown = ((milliToEnd / 1000) - numSecs) / 60; + final 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); + + LOGGER.info("Olympiad System: " + numDays + " days, " + numHours + " hours and " + numMins + " mins. until period ends"); + + if (_period == 0) + { + long milliToEnd2 = getMillisToWeekChange(); + + double numSecs1 = (milliToEnd2 / 1000) % 60; + double countDown1 = ((milliToEnd2 / 1000) - numSecs1) / 60; + final int numMins1 = (int) Math.floor(countDown1 % 60); + countDown1 = (countDown - numMins1) / 60; + int numHours1 = (int) Math.floor(countDown1 % 24); + int numDays1 = (int) Math.floor((countDown1 - numHours1) / 24); + + LOGGER.info("Olympiad System: Next weekly change in " + numDays1 + " days, " + numHours1 + " hours and " + numMins1 + " mins."); } How do I put the days that are missing from the community htm? I mean, what code does it have to be used on HTM to display? Quote
Monoksidas Posted November 16, 2017 Posted November 16, 2017 Hey, i have a question! I'm added this code, changed config to: # You can decide if enable custom period setting feature. Once enabled, # Alt Oly period: MONTH/DAY/WEEK # es. 2weeks-->AltOlyPeriod=WEEK and AltOlyPeriodMultiplier=2 AltOlyUseCustomPeriodSettings= True AltOlyPeriod = WEEK AltOlyPeriodMultiplier = 1 Deleted everything from Olympiad.cfg Restarted our server, and for me now show in console this: INFO Olympiad System: Loading Olympiad System.... INFO Olympiad System: Currently in Olympiad Period INFO Olympiad System: 14 days, 23 hours and 8 mins. until period ends INFO Olympiad System: Next weekly change in 0 days, 5 hours and 45 mins. INFO Olympiad System: Loaded 0 Nobles INFO Olympiad System: Competition Period Starts in 0 days, 5 hours and 8 mins. INFO Olympiad System: Event starts/started : Thu Nov 16 18:00:26 EET 2017 INFO Hero System: Loaded 0 Heroes. INFO Hero System: Loaded 0 all time Heroes. So my question is, then will change heroes now? Quote
KruMix Posted November 16, 2017 Posted November 16, 2017 (edited) INFO Olympiad System: Next weekly change in 0 days, 5 hours and 45 mins. Heroes will change after this time, so the new circle will start after this time. Edited November 16, 2017 by KruMix Quote
Monoksidas Posted November 16, 2017 Posted November 16, 2017 Now show that: INFO Olympiad System: Loading Olympiad System.... INFO Olympiad System: Currently in Olympiad Period INFO Olympiad System: 14 days, 10 hours and 35 mins. until period ends INFO Olympiad System: Next weekly change in 0 days, 5 hours and 12 mins. INFO Olympiad System: Loaded 0 Nobles INFO Olympiad System: Competition Period Starts in 0 days, 16 hours and 35 mins. INFO Olympiad System: Event starts/started : Fri Nov 17 18:00:21 EET 2017 INFO Hero System: Loaded 0 Heroes. INFO Hero System: Loaded 0 all time Heroes. i don't think that is true. So heroes frozen changing not on Sunday night? Quote
KruMix Posted November 16, 2017 Posted November 16, 2017 Something is weird, you are right, the period will end after this time 14 days, 10 hours and 35 mins. Try to give heroes manually and after see if the period will be for 7 days. Quote
Monoksidas Posted November 16, 2017 Posted November 16, 2017 I make manual heroes, and restarted server. Now show in console: INFO Olympiad System: Loading Olympiad System.... INFO Olympiad System: Currently in Validation Period INFO Olympiad System: 0 days, 23 hours and 58 mins. until period ends INFO Olympiad System: Loaded 0 Nobles INFO Hero System: Loaded 0 Heroes. INFO Hero System: Loaded 0 all time Heroes. Quote
Monoksidas Posted November 17, 2017 Posted November 17, 2017 40 minutes ago, SweeTs said: There is a 24h 'validation' window. so how to set this setup, to change heroes every sunday night at 00:00? Because i can't understand that console info.. Quote
Monoksidas Posted November 17, 2017 Posted November 17, 2017 protected void setNewOlympiadEndCustom() { final SystemMessage sm = new SystemMessage(SystemMessageId.OLYMPIAD_PERIOD_S1_HAS_STARTED); sm.addNumber(_currentCycle); Announcements.getInstance().announceToAll(sm); final 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); final 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 { // nothing to do, too low period } } 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(); } private void schedulePointsRestoreCustom() { long final_change_period = WEEKLY_PERIOD; switch (Config.ALT_OLY_PERIOD) { case DAY: { if (Config.ALT_OLY_PERIOD_MULTIPLIER < 10) { final_change_period = WEEKLY_PERIOD / 2; } } break; case WEEK: { if (Config.ALT_OLY_PERIOD_MULTIPLIER == 1) { final_change_period = WEEKLY_PERIOD / 2; } } break; } _scheduledWeeklyTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new OlympiadPointsRestoreTask(final_change_period), getMillisToWeekChange(), final_change_period); } class OlympiadPointsRestoreTask implements Runnable { private final long restoreTime; public OlympiadPointsRestoreTask(final long restoreTime) { this.restoreTime = restoreTime; } @Override public void run() { addWeeklyPoints(); LOGGER.info("Olympiad System: Added points to nobles"); final Calendar nextChange = Calendar.getInstance(); _nextWeeklyChange = nextChange.getTimeInMillis() + restoreTime; } } } This is the part of Olympiad.java code. Quote
SweeTs Posted November 17, 2017 Posted November 17, 2017 Change the validation to few hours. So, the same day 18 new cycle should start. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.