python Metin2 - Events Calendar

6 posts in this topic

Thanks to @Mithras01 that he reminded me about bisection years. (i'll update the repository when i'll have a bit more free time)

Leap Year

  • A normal year has 365 days. 
  • A Leap Year has 366 days (the extra day is the 29th of February).
yes Leap Years are any year that can be exactly divided by 4 (such as 2012, 2016, etc)
  not except if it can be exactly divided by 100, then it isn't (such as 2100, 2200, etc)
    yes except if it can be exactly divided by 400, then it is (such as 2000, 2400)
def GetRangeDaysMonth(calendarMonth):
	def GetBisectionYear(year):
		""" Provides support for maintaining a list in sorted order without having to sort the list after each insertion.
			Return True for leap years, False for non-leap years.
		return year % 4 == 0 and (year % 100 <> 0 or year % 400 == 0)

	""" TODO-DONE: Fix the calendar range days-month if month is February and is a bisection year like 2016, 2020, 2024 ... """
	return Math.OFFSETS_MONTH_RANGE_TUPLE[calendarMonth - 1] + (calendarMonth == 2 and GetBisectionYear(Math.GetCurrentYear()))



print DBG_GetRangeDaysMonth(2, 2018) # February 2018	
print DBG_GetRangeDaysMonth(2, 2019) # February 2019
print DBG_GetRangeDaysMonth(2, 2020) # February 2020
print DBG_GetRangeDaysMonth(2, 2024) # February 2024

<<<< 28
<<<< 28
<<<< 29
<<<< 29



  • Like 1

Share this post

Link to post
Share on other sites

Why u guys don't read text-informations from Git?



  • EVENTS_CALENDAR_DICT is just a configuration for <Python-Live-Test>.
  • The struct of the dictionary need to get it like EVENTS_CALENDAR_DICT = calendar.GetEventsData() << Source Client < Server

Also i'm sure you didn't understand how's work too, check with careful, you don't need to add events for each day/week etc, all are automatic.

  • 'WEEKLY' - 1 event = 48 objects (1 * 4 * 12) << Insert the event by a specific day of week for each month.
  • 'DAILY' - 1 event = 336-372 objects  (1 * 28-31 * 12) << Insert the event for all days in each month.
  • 'MONTHLY' = 1 event = 1 object << Insert the event by a specific day of month. 
  • 'ANNUALLY' - 1 event = 1 object << Insert the event by a specific month, week from month and day from week.

I said in the main post, this is just the python module part, the dictionary with config is just for live-test-debug, you've to parser how you want, from source client which is sended by a packet from server bla bla, is ur business how you want to do it, not mine, there's missing some things, you can get the classes/funcs and extend with your features/design etc.


PS: This module is for people who know what they've to do and know to read the code and make it work as they want, not for beginners.
As i said, don't ask for support implementation, the module doesn't contain all resources, is just for "developers".

  • Like 2

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.