Jump to content

Recommended Posts

Posted

image.jpg

 

image.jpg

-			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.");
			}
  • Like 1
  • Upvote 1
  • 4 weeks later...
  • 1 month later...
Posted (edited)

 

image.jpg

 

 

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 by vecc
  • 2 months later...
Posted

 

image.jpg

 

image.jpg

-			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?

  • 3 months later...
Posted

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?

Posted (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 by KruMix
Posted

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?

Posted

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.

Posted

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.

Posted
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..

Posted
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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...