Jump to content

Recommended Posts

  • Forum Moderator

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )

 

There's just a smart python module which i did for fun, for a friend, no support for implementation.

Enjoy. 

Github repository:

This is the hidden content, please

  • Metin2 Dev 303
  • kekw 4
  • Eyes 7
  • Flame 1
  • Dislove 4
  • Angry 1
  • Smile Tear 3
  • Think 3
  • Confused 1
  • Scream 1
  • Lmao 1
  • Good 113
  • muscle 1
  • Love 21
  • Love 211
Link to comment
https://metin2.dev/topic/20902-metin2-events-calendar/
Share on other sites

  • Forum Moderator

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()))

Output-test:

Spoiler

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

 

 

  • Good 3
  • Love 1
Link to comment
https://metin2.dev/topic/20902-metin2-events-calendar/#findComment-113349
Share on other sites

Thanks Vegas!

Is it possible to read the events from database?

🖥️ SysAdmin — Government (HU)
🛠️ Freelance Metin2 Dev • DevOps
🐧 FreeBSD / Linux | 🛡️ Security & WAF | 🚀 Performance | 🔥 Firewalls | ⚙ Automation
Open to work - Contact me on Discord @matteo_r

Link to comment
https://metin2.dev/topic/20902-metin2-events-calendar/#findComment-113350
Share on other sites

  • Forum Moderator

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

Spoiler

ddlzdab.png

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

pgGpaab.png

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

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Love 2
Link to comment
https://metin2.dev/topic/20902-metin2-events-calendar/#findComment-113357
Share on other sites

  • 6 years later...

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.